]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/internal/testdir: stop manually adding GOROOT/bin to PATH
authorDmitri Shuralyov <dmitshur@golang.org>
Fri, 26 May 2023 00:26:00 +0000 (20:26 -0400)
committerGopher Robot <gobot@golang.org>
Fri, 26 May 2023 20:41:52 +0000 (20:41 +0000)
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 <bcmills@google.com>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
src/cmd/internal/testdir/testdir_test.go

index c86cc20a9cab81d2d85c0983712da9a2320cf022..f10dacb974dbd8c13e6a9c6d5a93f379a8cfe877 100644 (file)
@@ -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