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{}) } }