From 1f11ea6c41e6ef323e9201649ad4863808342669 Mon Sep 17 00:00:00 2001 From: qmuntal Date: Fri, 9 Jun 2023 10:30:40 +0200 Subject: [PATCH] cmd/go: fix TestScript/gotoolchain* when go.env doesn't set GOTOOLCHAIN=auto Some of the TestScript/gotoolchain* tests assume that go.env contains GOTOOLCHAIN=auto, but that's not always the case, for example CI environments may set it to `local` to avoid downloading a new toolchain. This commit fixes the tests to work regardless of the value of GOTOOLCHAIN in go.env. Fixes #60685 Change-Id: Ieda22574f8a028893762274cf9db721c9d69bf7e Reviewed-on: https://go-review.googlesource.com/c/go/+/502035 TryBot-Result: Gopher Robot Run-TryBot: Quim Muntal Reviewed-by: Bryan Mills Reviewed-by: Eli Bendersky Auto-Submit: Bryan Mills --- src/cmd/go/script_test.go | 1 + src/cmd/go/testdata/script/gotoolchain_local.txt | 8 +------- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/src/cmd/go/script_test.go b/src/cmd/go/script_test.go index a2c1087bd8..d0099888d9 100644 --- a/src/cmd/go/script_test.go +++ b/src/cmd/go/script_test.go @@ -246,6 +246,7 @@ func scriptEnv(srv *vcstest.Server, srvCertFile string) ([]string, error) { "goversion=" + version, "CMDGO_TEST_RUN_MAIN=true", "HGRCPATH=", + "GOTOOLCHAIN=auto", "newline=\n", } diff --git a/src/cmd/go/testdata/script/gotoolchain_local.txt b/src/cmd/go/testdata/script/gotoolchain_local.txt index 313c541501..0e08207f45 100644 --- a/src/cmd/go/testdata/script/gotoolchain_local.txt +++ b/src/cmd/go/testdata/script/gotoolchain_local.txt @@ -5,14 +5,8 @@ env TESTGO_VERSION=go1.500 env TESTGO_VERSION_SWITCH=switch -# Default setting should be auto -env GOTOOLCHAIN= -go env GOTOOLCHAIN -stdout auto -go env -stdout GOTOOLCHAIN=.?auto.? # maybe quoted - # GOTOOLCHAIN=auto runs default toolchain without a go.mod or go.work +env GOTOOLCHAIN=auto go version stdout go1.500 -- 2.50.0