cmd/go: derive TestExecutableGOROOT environment from tg.env instead of os.Environ()
TestExecutableGOROOT, unlike most other tests in go_test.go, was running subcommands in a process with an environment derived directly from os.Environ(), rather than using tg.env on its testgoData object. Since tg.env is what sets GO111MODULE=off for GOPATH-mode tests, that caused TestExecutableGOROOT to unexpectedly run in module mode instead of GOPATH mode. If the user's environment included 'GOFLAGS=-mod=mod', that would cause the test to spuriously fail due to the inability to download modules to $HOME (which in this test binary is hard-coded to "/test-go-home-does-not-exist"). Updates #33848 Change-Id: I2f343008dd9e38cd76b9919eafd5a3181d0cbd6f Reviewed-on: https://go-review.googlesource.com/c/go/+/205064 Run-TryBot: Bryan C. Mills <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Showing
Please register or sign in to comment