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 [1.16 backport] #46144

Closed
gopherbot opened this issue May 12, 2021 · 5 comments
Labels
CherryPickApproved Used during the release process for point releases FrozenDueToAge GoCommand cmd/go release-blocker
Milestone

Comments

@gopherbot
Copy link

@bcmills requested issue #46142 to be considered for backport to the next 1.16 minor release.

@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
Author

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
Author

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

@bcmills bcmills self-assigned this May 13, 2021
@dmitshur dmitshur added the GoCommand cmd/go label May 13, 2021
@mknyszek mknyszek added CherryPickApproved Used during the release process for point releases and removed CherryPickCandidate Used during the release process for point releases labels May 24, 2021
@mknyszek
Copy link
Contributor

From #46143 (comment):

Since this could cause users to break the invariants of a repo's go.mod if they use a newer toolchain on an older repo or an older toolchain on a newer repo (is that right?) as a result of changes in Go 1.17, I think this is OK to backport.

An error message in this case is probably better than a lot of confusion. IIUC, this is basically fixing a UX issue that could have lasting consequences?

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
Copy link
Author

Closed by merging c9f27b8 to release-branch.go1.16.

@gopherbot
Copy link
Author

Closed by merging f2222d8 to release-branch.go1.16.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
CherryPickApproved Used during the release process for point releases FrozenDueToAge GoCommand cmd/go release-blocker
Projects
None yet
Development

No branches or pull requests

4 participants