Skip to content

Commit 142b012

Browse files
dmitshurgopherbot
authored andcommitted
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 <[email protected]> Run-TryBot: Dmitri Shuralyov <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Auto-Submit: Dmitri Shuralyov <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]>
1 parent d8782e7 commit 142b012

File tree

1 file changed

+0
-16
lines changed

1 file changed

+0
-16
lines changed

src/cmd/internal/testdir/testdir_test.go

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -610,22 +610,6 @@ func (t test) run() error {
610610
cmd.Env = append(cmd.Env, "GOPATH="+tempDir)
611611
}
612612
cmd.Env = append(cmd.Env, "STDLIB_IMPORTCFG="+stdlibImportcfgFile())
613-
// Put the bin directory of the GOROOT that built this program
614-
// first in the path. This ensures that tests that use the "go"
615-
// tool use the same one that built this program. This ensures
616-
// that if you do "../bin/go run run.go" in this directory, all
617-
// the tests that start subprocesses that "go tool compile" or
618-
// whatever, use ../bin/go as their go tool, not whatever happens
619-
// to be first in the user's path.
620-
path := os.Getenv("PATH")
621-
newdir := filepath.Join(runtime.GOROOT(), "bin")
622-
if path != "" {
623-
path = newdir + string(filepath.ListSeparator) + path
624-
} else {
625-
path = newdir
626-
}
627-
cmd.Env = append(cmd.Env, "PATH="+path)
628-
629613
cmd.Env = append(cmd.Env, runenv...)
630614

631615
var err error

0 commit comments

Comments
 (0)