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.15 backport] #46143

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.15 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/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
Author

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

@bcmills bcmills self-assigned this May 13, 2021
@dmitshur dmitshur added the GoCommand cmd/go label May 13, 2021
@mknyszek
Copy link
Contributor

mknyszek commented May 24, 2021

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?

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

Closed by merging d9cffab to release-branch.go1.15.

@gopherbot
Copy link
Author

Closed by merging fbf844b to release-branch.go1.15.

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 Jun 2, 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
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