From e709992afda6a96f0a5691aaf0883e3cfbd46946 Mon Sep 17 00:00:00 2001 From: qiulaidongfeng <2645477756@qq.com> Date: Thu, 6 Jun 2024 13:50:29 +0000 Subject: [PATCH] cmd/go: avoid when go.env contain GOTOOLCHAIN=local test fail 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 Reviewed-by: Michael Matloob LUCI-TryBot-Result: Go LUCI --- src/cmd/go/testdata/script/env_changed.txt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/cmd/go/testdata/script/env_changed.txt b/src/cmd/go/testdata/script/env_changed.txt index a3d368cd39..37d6571938 100644 --- a/src/cmd/go/testdata/script/env_changed.txt +++ b/src/cmd/go/testdata/script/env_changed.txt @@ -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 -- 2.48.1