-
Notifications
You must be signed in to change notification settings - Fork 17.6k
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: go mod download and go mod tidy produce different go.sum #35832
Comments
Also #27633 |
go mod download
and go mod tidy
produce different go.sum
files
@juliehockett Thanks for the detailed example! I agree that this sounds like a duplicate of #27633. There are some more details here https://github.com/golang/go/wiki/Modules#why-does-go-mod-tidy-record-indirect-and-test-dependencies-in-my-gomod and https://tip.golang.org/cmd/go/#hdr-Maintaining_module_requirements. I'll close this bug in favor of discussing on #27633. |
Thanks for the response! I'm actually thinking this might be subtly different, because we've also run into this as because Our solution thus far has been to run (I'm commenting on this bug because the duplicate liked looks like it's talking about differences in the |
Thanks, I'll re-open. Let's cc @bcmills and @jayconrod who own |
This is likely related to #29772. That said, it would be helpful to have an exact reproducer for this: the @juliehockett, could you provide the |
You bet -- main.go (a simple HTTP test) is:
|
Oh, I get it now.
On the other hand, So this is a bit confusing (and we should think about that some more when other issues are reported), but the behavior originally reported seems correct, at least in the sense that everything is working as designed and neither command is doing any work beyond what it was asked to do. For your use case, |
What version of Go are you using (
go version
)?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?
Running 'go mod download' produces a different 'go.sum' file than running 'go mod tidy'.
Given a simple main program with the following 'go.mod':
Running 'go mod download' produces the following 'go.sum':
While running 'go mod tidy' produces:
What did you expect to see?
The same
go.sum
file produced for both commands.What did you see instead?
A second line for each dependency in the file produced by 'go mod tidy'. Seems like it's hashing the go.mod file and the package itself, but that's unclear to me.
The text was updated successfully, but these errors were encountered: