Skip to content
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: error out of 'go mod tidy' if the go.mod file specifies a newer-than-supported Go version #46142

Closed
bcmills opened this issue May 12, 2021 · 7 comments
Labels
FrozenDueToAge modules NeedsFix The path to resolution is known, but the work has not been done. release-blocker
Milestone

Comments

@bcmills
Copy link
Contributor

bcmills commented May 12, 2021

For #36460, Go 1.17 will add redundancy in go.mod files that would be removed by go mod tidy in earlier versions of the toolchain. We should make go mod tidy fail if it doesn't definitively know what invariants a tidy module requires — that is, if the go.mod file specifies a newer-than-supported version of the toolchain.

(@jayconrod, @matloob: I thought we already had an issue filed for this but I can't find it now. Does it ring a bell?)

@bcmills bcmills added NeedsFix The path to resolution is known, but the work has not been done. release-blocker labels May 12, 2021
@bcmills bcmills added this to the Go1.17 milestone May 12, 2021
@bcmills bcmills self-assigned this May 12, 2021
@bcmills
Copy link
Contributor Author

bcmills commented May 12, 2021

@gopherbot, please backport to Go 1.15 and 1.16. We don't want users on older Go releases to accidentally break the invariants of the modules they're working in.

@gopherbot
Copy link

Backport issue(s) opened: #46143 (for 1.15), #46144 (for 1.16).

Remember to create the cherry-pick CL(s) as soon as the patch is submitted to master, according to https://golang.org/wiki/MinorReleases.

@gopherbot
Copy link

Change https://golang.org/cl/319669 mentions this issue: cmd/go: error out of 'go mod tidy' if the go version is newer than supported

@gopherbot
Copy link

Change https://golang.org/cl/319671 mentions this issue: [release-branch.go1.16] cmd/go: error out of 'go mod tidy' if the go version is newer than supported

@gopherbot
Copy link

Change https://golang.org/cl/319670 mentions this issue: [release-branch.go1.16] cmd/go: use a real Go version in the go.mod files in TestScript/mod_readonly

@gopherbot
Copy link

Change https://golang.org/cl/319709 mentions this issue: [release-branch.go1.15] cmd/go: use a real Go version in the go.mod files in TestScript/mod_readonly

@gopherbot
Copy link

Change https://golang.org/cl/319710 mentions this issue: [release-branch.go1.15] cmd/go: error out of 'go mod tidy' if the go version is newer than supported

gopherbot pushed a commit that referenced this issue Jun 2, 2021
…iles in TestScript/mod_readonly

For some reason, the go.mod file added to this test in CL 147281 lists
'go 1.20' instead of the version that was actually current when the
go.mod file was added.

That causes the test's behavior to change under lazy loading, because
1.20 is above the threshold to trigger lazy-loading invariants (1.17).

This backports CL 314049 to Go 1.16 in order to fix a spurious test
failure in a subsequent change.

For #46144
Updates #46142
Updates #36460

Change-Id: I92400996cb051ab30e99bfffafd91ff32a1e7087
Reviewed-on: https://go-review.googlesource.com/c/go/+/314049
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-on: https://go-review.googlesource.com/c/go/+/319670
Reviewed-by: Jay Conrod <jayconrod@google.com>
gopherbot pushed a commit that referenced this issue Jun 2, 2021
…version is newer than supported

This backports the test from CL 319669, but — because of extensive
changes to the module loader during the Go 1.17 cycle — the
implementation is entirely different. (This implementation is based on
the addGoStmt function present in init.go in the 1.16 branch.)

Fixes #46144
Updates #46142

Change-Id: Ib7a0a159e53cbe476be6aa9a050add10cc750dec
Reviewed-on: https://go-review.googlesource.com/c/go/+/319671
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
gopherbot pushed a commit that referenced this issue Jun 2, 2021
…iles in TestScript/mod_readonly

For some reason, the go.mod file added to this test in CL 147281 lists
'go 1.20' instead of the version that was actually current when the
go.mod file was added.

That causes the test's behavior to change under lazy loading, because
1.20 is above the threshold to trigger lazy-loading invariants (1.17).

This backports CL 314049 to Go 1.15 in order to fix a spurious test
failure in a subsequent change.

For #46143
Updates #46142
Updates #36460

Change-Id: I92400996cb051ab30e99bfffafd91ff32a1e7087
Reviewed-on: https://go-review.googlesource.com/c/go/+/314049
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-on: https://go-review.googlesource.com/c/go/+/319709
Reviewed-by: Jay Conrod <jayconrod@google.com>
gopherbot pushed a commit that referenced this issue Jun 2, 2021
…version is newer than supported

This backports the test from CL 319669, but — because of extensive
changes to the module loader during the Go 1.16 and 1.17 cycles — the
implementation is entirely different. (This implementation is based on
the addGoStmt function already present in init.go.)

Fixes #46143
Updates #46142

Change-Id: Ib7a0a159e53cbe476be6aa9a050add10cc750dec
Reviewed-on: https://go-review.googlesource.com/c/go/+/319710
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
@golang golang locked and limited conversation to collaborators May 15, 2022
@rsc rsc unassigned bcmills Jun 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge modules NeedsFix The path to resolution is known, but the work has not been done. release-blocker
Projects
None yet
Development

No branches or pull requests

2 participants