Reputation: 394
I am using third party packages in golang and I want to add them to my git repository and when I type the command git add .
it is giving me the following error
warning: adding embedded git repository: github.com/beorn7/perks
hint: You've added another git repository inside your current repository.
hint: Clones of the outer repository will not contain the contents of
hint: the embedded repository and will not know how to obtain it.
hint: If you meant to add a submodule, use:
hint:
hint: git submodule add <url> github.com/beorn7/perks
hint:
hint: If you added this path by mistake, you can remove it from the
hint: index with:
hint:
hint: git rm --cached github.com/beorn7/perks
hint:
How to make sure that I am version controlling packages correctly and Am I doing the right way of version controlling my third-party packages?
Here is my project structure
Project/
|
src/
|
github.com/
|
packages/
My GOPATH is also pointing to project directory
Upvotes: 2
Views: 919
Reputation: 820
From what I understand you don't use any package manager, instead you import packages to your $GOPATH. I would advise you to use package manager like dep
which builds vendor
directory containing all dependencies. When you run dep ensure
it will go through your code and pull all the dependencies automatically.
Edit:
As @jubobs since go1.11 you can use go mod
. Basic premise is the same as dep
.
Upvotes: 2