问题
I have a repository that looks like this:
src
|
|--myplace
|--myprojectRepo
|--someCmd
| main.go
|--somePackage
| package.go
I'm trying to use Godeps to manage dependencies. However, when I run godep save
inside of the someCmd
folder, it copies not just the external code into the godep _workspace
, but also the somePackage
code into the godep _workspace
.
Is there anyway to stop godep from copying code that is in the same repository into its _workspace
?
The main ugliness that I see with this is that now there are two versions of somePackage.go
. One in the somePackage
directory and one in the godeps/_workspace...
directory. And if I make a change to somePackage
, I have to rerun godep inside of someCmd
in order to have those changes pulled in.
回答1:
when I run godep save inside of the someCmd folder
Godep will vendor everything that is not a sub-directory, it does not goes up to your repository's root.
You have to run godep save ./...
from the root of your project : it will save all external dependencies for your project in one place.
As @JimB said, anyway people are gonna be pulling the whole repository at once, not sub-packages by sub-packages. And they should run godep restore
from the repository's root too.
来源:https://stackoverflow.com/questions/32589511/godep-with-local-packages