]> Cypherpunks repositories - gostls13.git/commit
[release-branch.go1.19] cmd/go: refuse to build Go 1.22 code
authorRuss Cox <rsc@golang.org>
Fri, 11 Aug 2023 14:58:26 +0000 (10:58 -0400)
committerGopher Robot <gobot@golang.org>
Fri, 11 Aug 2023 18:34:00 +0000 (18:34 +0000)
commit2f498f2222823fd44ee9a7d3856df2aa234209e9
treeb6d918634739086c03a2f9eee2c6d4376d4f9720
parent0ae54ddd37302bdd2a8c775135bf5f076a18eeb3
[release-branch.go1.19] cmd/go: refuse to build Go 1.22 code

With #60078 accepted, we expect Go 1.22 will have different
for loop semantics than Go 1.19 did.
Go 1.19 is already unsupported, but add a check anyway, just to
help catch some mistakes and usage of old Go toolchains
beyond their end-of-support.

Note that Go 1.19 can keep being used indefinitely with pre-Go 1.22 code.
This change only makes it refuse to build code that says it needs
Go 1.22 semantics, because Go 1.19 does not provide those.

Cherry-pick of the change from the Go 1.20 branch.

For #60078.

Change-Id: I75118d6fbd0cc08a6bc309aca54c389a255ba7dc
Reviewed-on: https://go-review.googlesource.com/c/go/+/518675
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-on: https://go-review.googlesource.com/c/go/+/518815
Auto-Submit: Russ Cox <rsc@golang.org>
TryBot-Bypass: Russ Cox <rsc@golang.org>
src/cmd/go/internal/work/exec.go
src/cmd/go/testdata/script/build_go122.txt [new file with mode: 0644]
src/cmd/go/testdata/script/mod_go_version.txt