mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
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 <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>
This commit is contained in:
parent
d8782e7061
commit
142b012e94
1 changed files with 0 additions and 16 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue