]> Cypherpunks.ru repositories - gostls13.git/commit
cmd/go: lock in new toolchain semantics
authorRuss Cox <rsc@golang.org>
Thu, 25 May 2023 15:59:50 +0000 (11:59 -0400)
committerGopher Robot <gobot@golang.org>
Tue, 30 May 2023 19:21:42 +0000 (19:21 +0000)
commit77bdf6d0e0d7c99e76fa69a5a6419eedcbcc8d84
tree2895e3a04198a7d94aff892a31a2f4e257249540
parent301370c81cd4f05949a42e0d0222f1fe35c1f761
cmd/go: lock in new toolchain semantics

The design doc says 'toolchain' lines apply even if the default
toolchain is older than the one specified in the toolchain line.
However, that leads to various confusing behavior and security issues.
Instead, treat toolchain as a min go version that only applies
in the current module (not in dependencies).

As an example of confusing behavior / security issue, if I install
Go 1.30 and then run 'go build' in a module I've checked out,
I expect to use Go 1.30 or newer, not to silently use an older toolchain
that may have security problems fixed in Go 1.30.
Making toolchain a min establishes that guarantee.

Also clean up the tests quite a bit.

Finally drop + from the acceptable version suffixes; we use + for +auto and +path.

For #57001.

Change-Id: Ia92c66be75d6d0e31cb4e2c0aa936fa4ec5c0a8c
Reviewed-on: https://go-review.googlesource.com/c/go/+/498260
Reviewed-by: Bryan Mills <bcmills@google.com>
Auto-Submit: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
src/cmd/go/internal/gover/toolchain.go
src/cmd/go/internal/gover/toolchain_test.go [new file with mode: 0644]
src/cmd/go/internal/modload/init.go
src/cmd/go/internal/modload/modfile.go
src/cmd/go/internal/toolchain/toolchain.go
src/cmd/go/testdata/script/gotoolchain.txt [deleted file]
src/cmd/go/testdata/script/gotoolchain_local.txt [new file with mode: 0644]
src/cmd/go/testdata/script/gotoolchain_net.txt [new file with mode: 0644]
src/cmd/go/testdata/script/gotoolchain_path.txt [new file with mode: 0644]
src/cmd/go/testdata/script/mod_get_future.txt
src/cmd/go/testdata/script/mod_go_version.txt