mirror of https://github.com/golang/go.git
cmd/go: set $GOROOT during 'go tool' invocations
cmd/dist now requires $GOROOT to be set explicitly. Set it when invoking via 'go tool dist' so that users are unaffected. Also, change go tool -n to drop trailing space in output for 'go tool -n <anything>'. Change-Id: I9b2c020e0a2f3fa7c9c339fadcc22cc5b6cb7cac Reviewed-on: https://go-review.googlesource.com/3011 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
dca54d7cdd
commit
e832043e72
|
|
@ -92,7 +92,11 @@ func runTool(cmd *Command, args []string) {
|
|||
return
|
||||
}
|
||||
if toolN {
|
||||
fmt.Printf("%s %s\n", toolPath, strings.Join(args[1:], " "))
|
||||
cmd := toolPath
|
||||
if len(args) > 1 {
|
||||
cmd += " " + strings.Join(args[1:], " ")
|
||||
}
|
||||
fmt.Printf("%s\n", cmd)
|
||||
return
|
||||
}
|
||||
toolCmd := &exec.Cmd{
|
||||
|
|
@ -101,6 +105,8 @@ func runTool(cmd *Command, args []string) {
|
|||
Stdin: os.Stdin,
|
||||
Stdout: os.Stdout,
|
||||
Stderr: os.Stderr,
|
||||
// Set $GOROOT, mainly for go tool dist.
|
||||
Env: mergeEnvLists([]string{"GOROOT=" + goroot}, os.Environ()),
|
||||
}
|
||||
err := toolCmd.Run()
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Reference in New Issue