]> Cypherpunks repositories - gostls13.git/commit
cmd/go: handle -C properly during toolchain switches
authorRuss Cox <rsc@golang.org>
Mon, 5 Jun 2023 15:19:03 +0000 (11:19 -0400)
committerRuss Cox <rsc@golang.org>
Tue, 6 Jun 2023 19:23:42 +0000 (19:23 +0000)
commit96d8d3eb3294e85972aed190aec1806ef3c30712
tree75e689a608af219e1ef9cf4a006d6093b7228507
parente23273ddd4145d41dd6a6b90b4ca5729aa200db8
cmd/go: handle -C properly during toolchain switches

The -C dir flag was added in Go 1.20.
This CL adds a new restriction: the -C must appear as the first flag on the command line.
This restriction makes finding the -C flag robust and matches the general way
people tend to think about and use the -C flag anyway.
It may break a few scripts that have been written since Go 1.20
but hopefully they will not be hard to find and fix.
(There is no strict compatibility guarantee for the command line.)

For #57001.

Change-Id: Ice2e5982c58d41eabdaef42a80d3624cde2c9873
Reviewed-on: https://go-review.googlesource.com/c/go/+/500915
TryBot-Bypass: Russ Cox <rsc@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
src/cmd/go/alldocs.go
src/cmd/go/internal/base/base.go
src/cmd/go/internal/base/flag.go
src/cmd/go/internal/vet/vet.go
src/cmd/go/internal/work/build.go
src/cmd/go/main.go
src/cmd/go/testdata/script/chdir.txt
src/cmd/go/testdata/script/mod_get_exec_toolchain.txt