-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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: 'mod verify' should not modify the go.mod file #31372
Comments
A helpful soul linked me to https://golang.org/cmd/go/#hdr-The_go_mod_file, which explains:
This seems like a very important piece of information (various Also, it seems like this is not really the right behavior. For commands that are meant to answer questions rather than change state ( Relatedly, the various build-related commands ( |
On the other hand, commands that answer questions need to at least resolve enough of the dependency graph to answer the question that was asked. For example, |
See #26850. |
Probably |
CC @jayconrod |
Hi, @jayconrod If I add a |
Change https://golang.org/cl/174258 mentions this issue: |
I wasn't able to reproduce this using the original instructions, but after replacing the crypto requirement with
More importantly though, We're in code freeze now, so I don't think this will be in for 1.13. |
The On the other hand, perhaps |
Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
go mod init
to create a go.mod file.git commit go.mod -m 'Use modules'
)go mod verify
git diff
What did you expect to see?
No output.
What did you see instead?
Several lines changed.
Specifically, what happened here is that Boulder depends on a number of packages. Some of those packages have opted into modules, and have their own dependencies listed in go.mod.
For instance, as of right now, Boulder has
golang.org/x/crypto
vendored at 0709b304 usinggodep
.go mod init
correctly picks up that version and puts it in go.mod. Boulder also depends onchalltestsrv
v1.0.2.challtestsrv
v1.0.2 has a go.mod that depends ongolang.org/x/crypto
505ab14 (which is later than 0709b30). Runninggo mod verify
changes Boulder's go.mod to depend on 505ab14.It seems like
go mod verify
is performing theminimal version selection
algorithm and updating go.mod. I would expect thatgo mod verify
doesn't change anything, based on the documentation, which says:The text was updated successfully, but these errors were encountered: