-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/go: make go mod download
with no arguments leave go.sum alone
#45332
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
Comments
@gopherbot, please add labels GoCommand, modules |
This was an intentional change in 1.16, but I don't think we should close this issue unless we're sure this is the behavior we want. Previously, One particular problem we were trying to solve: with the switch to If one of the sums is missing, we need a command more focused than We've gotten a fair amount of feedback that this isn't what people expect when running |
Incidentally, until this issue is resolved, I'd recommend |
Marking as release blocker to force a decision for 1.17. |
@jayconrod Do you have any more thoughts on this? Checking in as it is labeled a release-blocker for Go 1.17. |
@jayconrod suggests that 'go mod download' with no arguments be defined to never edit go.sum. |
go mod download
adds unnecessary entries to go.sum
go mod download
with no arguments leave go.sum alone
Change https://golang.org/cl/318629 mentions this issue: |
Change https://golang.org/cl/318811 mentions this issue: |
In anticipation of CL 318629, 'go mod download' without arguments will not update go.mod or go.sum. Before 1.16, 'go mod download' would adds sums for .mod files but not .zip files (which people didn't usually notice). Many folks found the behavior of adding sums for .zip files to be annoying. This change alters tests to run 'go mod download all' to populate go.sum files. This is equivalent to 'go mod download' without arguments before CL 318629. For golang/go#45332 Change-Id: I387d514176f798ae8f17b0b056194196718f57f5 Reviewed-on: https://go-review.googlesource.com/c/tools/+/318811 Trust: Jay Conrod <[email protected]> Run-TryBot: Jay Conrod <[email protected]> gopls-CI: kokoro <[email protected]> TryBot-Result: Go Bot <[email protected]> Reviewed-by: Bryan C. Mills <[email protected]>
@gopherbot Please backport to 1.16. We plan to revert to the 1.15 behavior. |
Backport issue(s) opened: Remember to create the cherry-pick CL(s) as soon as the patch is submitted to master, according to https://golang.org/wiki/MinorReleases. |
@jayconrod This is still open, checking what is there still left to do here? Thanks. |
The fix is ready, but I'm waiting on a review. |
Change https://golang.org/cl/321956 mentions this issue: |
As of CL 318629, 'go mod download' without arguments does not save checksums for module source code. Without a checksum, 'go list' will not report the location of the source code even if it is present, in order to prevent accidental access of mismatched code. Downloading an explicit module here also more clearly expresses the intent of the test (“download this module and see where it is”), and may be somewhat more efficient (since the test doesn't need source code for the other modules in the build list). Updates #45332 Change-Id: Ic589b22478e3ed140b95365bb6729101dd598ccc Reviewed-on: https://go-review.googlesource.com/c/go/+/321956 Trust: Bryan C. Mills <[email protected]> Run-TryBot: Bryan C. Mills <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]> TryBot-Result: Go Bot <[email protected]>
Change https://golang.org/cl/322369 mentions this issue: |
…ements 'go mod download' calls modload.LoadModFile early to find the main module path in order to validate arguments. LoadModFile may write go.mod and go.sum to fix formatting and add a go directive. This calls keepSums, which, in eager mode, loaded the complete module graph in order to find out what sums are needed to load the complete module graph. If go.mod requires a lower version of a module than will be selected later, keepSums causes the sum for that version's go.mod to be retained, even though it isn't needed later after a consistent go.mod is written. This CL fixes keepSums not to load the graph if it hasn't already been loaded (whether eager or lazy), addressing comments from CL 318629. For #45332 Change-Id: I20d4404004e4ad335450fd0fd753e7bc0060f702 Reviewed-on: https://go-review.googlesource.com/c/go/+/322369 Trust: Jay Conrod <[email protected]> Run-TryBot: Bryan C. Mills <[email protected]> Reviewed-by: Bryan C. Mills <[email protected]> TryBot-Result: Go Bot <[email protected]>
In anticipation of CL 318629, 'go mod download' without arguments will not update go.mod or go.sum. Before 1.16, 'go mod download' would adds sums for .mod files but not .zip files (which people didn't usually notice). Many folks found the behavior of adding sums for .zip files to be annoying. This change alters tests to run 'go mod download all' to populate go.sum files. This is equivalent to 'go mod download' without arguments before CL 318629. For golang/go#45332 Change-Id: I387d514176f798ae8f17b0b056194196718f57f5 Reviewed-on: https://go-review.googlesource.com/c/tools/+/318811 Trust: Jay Conrod <[email protected]> Run-TryBot: Jay Conrod <[email protected]> gopls-CI: kokoro <[email protected]> TryBot-Result: Go Bot <[email protected]> Reviewed-by: Bryan C. Mills <[email protected]>
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?
$ git clone -b v1.1.5 https://github.com/aofei/sandid.git $ cd sandid $ go mod download $ git diff diff --git a/go.sum b/go.sum index c221f64..ec9d676 100644 --- a/go.sum +++ b/go.sum @@ -3,6 +3,7 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= $ go mod tidy $ git status Not currently on any branch. nothing to commit, working tree clean
What did you expect to see?
I expect to see that
go mod download
doesn't change anything. Or, at least it shouldn't fight withgo mod tidy
.What did you see instead?
It adds unnecessary entries to
go.sum
.A possible solution is to
modload.TrimGoSum
beforemodload.WriteGoMod(ctx)
.Or, maybe
go mod download
shouldn't updatego.mod
orgo.sum
at all. Maybe people just expect it to fill the local cache. So another possible solution is to removemodload.WriteGoMod(ctx)
.@jayconrod @bcmills @matloob
The text was updated successfully, but these errors were encountered: