-
Notifications
You must be signed in to change notification settings - Fork 17.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
x/vgo: vgo build and vgo mod -sync produce different list of dependencies #25971
Comments
The difference here is in the build tags: In contrast, |
Thank you for the update. In this case, what is preferred to invoke? Also, in the case of third-party tooling that wants to support users work on vgo enabled apps, what is preferred to run? I understand the difference in these run modes but I think that in order to minimize the friction with developers, both commands should behave the same. |
To be clear: I'm not saying that (I tend to agree with you that they should be equivalent, but that invariant has a non-trivial cost. I'm curious to find out @rsc's thoughts on the matter.) |
They should not be equivalent. go build should be lazy and do minimal work for that GOOS, GOARCH, and tag-set. go mod x is for managing the mod requirements regardless of the current system setup. This is similar to how govendor works. This attribute is important. One project I work on I develop on Linux and deploy to windows. I don't want my deploy step pulling down extra un-reviewed deps. So when I update dependencies they ignore current GOOS values. This is also why govendor had to reimplement package discovery. Issue #25873 is about limiting the scope of the mod subcommand, but would not affect go build. |
I chatted a bit about this with Russ this morning, and his interpretation agrees with @kardianos' comment: Personally, I would recommend |
What version of Go are you using (
go version
)?go version go1.10.3 linux/amd64
golang/vgo@f574d31
Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?cross-platform issue
What did you do?
In the following case, having the files outside of GOPATH:
Then run
vgo build
. Cleanup thego.mod
file to the one in the issue and now runvgo mod -sync
.What did you expect to see?
vgo build
produces the followinggo.mod
vgo mod -sync
produces the followinggo.mod
What did you see instead?
I expect the file to be similar in both cases.
And given that
vgo build
produces a working code, I expect thatvgo build
is the minimal source of truth in this case.Maybe this works as expected but in this case, more documentation would be useful as
vgo build
will be significantly faster thanvgo mod -sync
in case of many dependencies that need to be downloaded if the pattern can replicate in larger projects.The text was updated successfully, but these errors were encountered: