From: Dmitri Shuralyov Date: Fri, 26 May 2023 00:26:00 +0000 (-0400) Subject: cmd/internal/testdir: stop manually adding GOROOT/bin to PATH X-Git-Tag: go1.21rc1~205 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=142b012e94c6be50ee07ca42686c4121d188bde5;p=gostls13.git cmd/internal/testdir: stop manually adding GOROOT/bin to PATH The go command already places $GOROOT/bin at the beginning of $PATH in the test's environment as of Go 1.19¹, so there's no need for the test to do it anymore. Start enjoying yet another benefit of using 'go test'. ¹ See go.dev/issue/57050. For #56844. Change-Id: If7732cd8b8979eabf185485d3c73858a4e546d69 Reviewed-on: https://go-review.googlesource.com/c/go/+/498271 Reviewed-by: Bryan Mills Run-TryBot: Dmitri Shuralyov TryBot-Result: Gopher Robot Auto-Submit: Dmitri Shuralyov Reviewed-by: Dmitri Shuralyov --- diff --git a/src/cmd/internal/testdir/testdir_test.go b/src/cmd/internal/testdir/testdir_test.go index c86cc20a9c..f10dacb974 100644 --- a/src/cmd/internal/testdir/testdir_test.go +++ b/src/cmd/internal/testdir/testdir_test.go @@ -610,22 +610,6 @@ func (t test) run() error { cmd.Env = append(cmd.Env, "GOPATH="+tempDir) } cmd.Env = append(cmd.Env, "STDLIB_IMPORTCFG="+stdlibImportcfgFile()) - // Put the bin directory of the GOROOT that built this program - // first in the path. This ensures that tests that use the "go" - // tool use the same one that built this program. This ensures - // that if you do "../bin/go run run.go" in this directory, all - // the tests that start subprocesses that "go tool compile" or - // whatever, use ../bin/go as their go tool, not whatever happens - // to be first in the user's path. - path := os.Getenv("PATH") - newdir := filepath.Join(runtime.GOROOT(), "bin") - if path != "" { - path = newdir + string(filepath.ListSeparator) + path - } else { - path = newdir - } - cmd.Env = append(cmd.Env, "PATH="+path) - cmd.Env = append(cmd.Env, runenv...) var err error