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>
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{
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 {