]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: avoid when go.env contain GOTOOLCHAIN=local test fail
authorqiulaidongfeng <2645477756@qq.com>
Thu, 6 Jun 2024 13:50:29 +0000 (13:50 +0000)
committerMichael Matloob <matloob@golang.org>
Fri, 7 Jun 2024 18:49:03 +0000 (18:49 +0000)
The test fail when $GOROOT/go.env contain GOTOOLCHAIN=local
because GOTOOLCHAIN=local is assumed to be a non-default value.
This CL fixed the test failure
by using go.env from the test as $GOROOT/go.env throughout the test.
Test have also been added to ensure that
when $GOROOT/go.env contain GOTOOLCHAIN=local,
GOTOOLCHAIN=local is not taken as a non-default value.

Fixes #67793

Change-Id: Ibc5057d38d36c6c55726a039de1e7c37d6935b52
GitHub-Last-Rev: 12b62464e671021320c54e251dfb1ebcb5925096
GitHub-Pull-Request: golang/go#67807
Reviewed-on: https://go-review.googlesource.com/c/go/+/590196
Reviewed-by: Sam Thanawalla <samthanawalla@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

src/cmd/go/testdata/script/env_changed.txt

index a3d368cd39e4807d1a7afe636ecffd746c2dc904..37d6571938cba6b7c2983013501cde01db145edf 100644 (file)
@@ -1,5 +1,6 @@
 # Test query for non-defaults in the env
 
+env GOROOT=./a
 env GOTOOLCHAIN=local
 env GOSUMDB=nodefault
 env GOPROXY=nodefault
@@ -44,7 +45,6 @@ go env -changed -json GOARCH
 [GOARCH:amd64] stdout '"GOARCH": "arm64"'
 [!GOARCH:amd64] stdout '"GOARCH": "amd64"'
 
-env GOROOT=./a
 env GOPROXY=s
 go env -changed GOPROXY
 ! stdout 'GOPROXY'
@@ -52,5 +52,12 @@ env GOPROXY=s2
 go env -changed GOPROXY
 stdout 'GOPROXY=''?s2''?'
 
+env GOROOT=./b
+go env -changed
+! stdout 'GOTOOLCHAIN=''?local''?'
+
 --  a/go.env --
 GOPROXY=s
+
+--  b/go.env --
+GOTOOLCHAIN=local