I have a package structure that looks like this:
GOPATH
src
github.com/myname
mymainproject
something.go //imports things from github
mysubproject
main.go //imports "github.com/myname/mymainproject" + others
As part of m build I run, go get -u -t ./..
from the main directory. This works great if building from master, but I have jenkins configured to build from any branch.
When building from another branch though, when it updates dependencies of mysubproject
it updates the full working directory to master, which is very much not what I want.
I only have two real ideas that might work:
- After I run
go get
, check out the original branch that I want to build. I still worry that switching branches mid go-get could cause it to skip some dependencies that exist only in the branch, or fetch unnecessarily ones that exist only in master, so I'm not sure this is a good solution. - Tag the current commit on the branch with the magic
go1
tag. I believe this would have to be done on the remote as well, which makes it much less appealing.
Is there any way to prevent go-get from touching my main repository?