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
cmd/go: module-aware "go get" updates go.mod unexpectedly #27353
Comments
From the doc:
|
Seems like working as intended. You initially have pinned to an earlier version. Now without any If you want this behavior to change, I would request you to open a proposal instead, outlining the reasoning behind it and how it will be helpful. Closing, since this is not a bug. |
Agreed, this is a change in behavior. The rationale behind it is pretty interesting I think. It was described in one of the initial vgo posts: https://research.swtch.com/vgo-cmd It’s worth reading that whole post if you are interested, but some related snippets:
And later:
|
Regardless of the help text or the reasoning behind the change, this is still a behavior change from how |
What version of Go are you using (
go version
)?go version go1.11 linux/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?not relevant
What did you do?
go.mod
.go get github.com/golang/mock@v1.0
.Note
go.mod
will now contain gomock pinned tov1.0.1
.go get github.com/golang/mock
What did you expect to see?
No modifications to
go.mod
by step 3.What did you see instead?
go.mod
is updated to havegithub.com/golang/mock
pinned tov1.1.1
.go get
should not modify a dependency's version ingo.mod
unless-u
is specified.This is counter-intuitive and behaves differently from the non-module-aware
go get
, which by default leaves the currently-installed version if one is present, and only updates to the latest version if-u
is specified.The text was updated successfully, but these errors were encountered: