aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2023-07-27 15:56:37 -0400
committerRuss Cox <rsc@golang.org>2023-08-01 18:40:48 +0000
commit363f2594aabc2ae4ef326e5c2691fd0ebb14390e (patch)
tree8aec9d601dadde1e7485f431562c501dd3fa91fc
parent9b53b9b585023aa8a38f87832de8d96e7278f121 (diff)
downloadgo-363f2594aabc2ae4ef326e5c2691fd0ebb14390e.tar.gz
go-363f2594aabc2ae4ef326e5c2691fd0ebb14390e.zip
[release-branch.go1.21] cmd/go: make go list -m -u all not complain about missing checksums
This is a band-aid of a fix for Go 1.21, to create space to work on a real fix for Go 1.22, if in fact the real fix is different. It simply disables the go.sum update check during go list -m -u. I don't have a self-contained test for the breakage. See #61605. All existing tests continue to pass. For #61605. After merging into the Go 1.21 branch we can move #61605 to the Go 1.22 milestone. Change-Id: Ib155710092003f08d2a6ce0aefa8e0270cad5a5c Reviewed-on: https://go-review.googlesource.com/c/go/+/514899 Reviewed-by: Michael Matloob <matloob@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
-rw-r--r--src/cmd/go/internal/modload/list.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/cmd/go/internal/modload/list.go b/src/cmd/go/internal/modload/list.go
index 1f210b831e..e8872ba4b8 100644
--- a/src/cmd/go/internal/modload/list.go
+++ b/src/cmd/go/internal/modload/list.go
@@ -110,7 +110,13 @@ func ListModules(ctx context.Context, args []string, mode ListMode, reuseFile st
if err == nil {
requirements = rs
- if !ExplicitWriteGoMod {
+ // TODO(#61605): The extra ListU clause fixes a problem with Go 1.21rc3
+ // where "go mod tidy" and "go list -m -u all" fight over whether the go.sum
+ // should be considered up-to-date. The fix for now is to always treat the
+ // go.sum as up-to-date during list -m -u. Probably the right fix is more targeted,
+ // but in general list -u is looking up other checksums in the checksum database
+ // that won't be necessary later, so it makes sense not to write the go.sum back out.
+ if !ExplicitWriteGoMod && mode&ListU == 0 {
err = commitRequirements(ctx, WriteOpts{})
}
}