Commit b38fa898 authored by Russ Cox's avatar Russ Cox

cmd/go: force default env vars onto tool subprocesses

This avoids needing every invoked tool to have an identical
computation of the build defaults as the go command does.
It makes sure the tools all know what the go command wants.

Change-Id: I484f15982bfb93c86cde8fc9df7f456505270b87
Reviewed-on: https://go-review.googlesource.com/6409Reviewed-by: default avatarRob Pike <r@golang.org>
parent deff22dd
......@@ -152,6 +152,15 @@ func main() {
os.Exit(2)
}
// Set environment (GOOS, GOARCH, etc) explicitly.
// In theory all the commands we invoke should have
// the same default computation of these as we do,
// but in practice there might be skew
// This makes sure we all agree.
for _, env := range mkEnv() {
os.Setenv(env.name, env.value)
}
for _, cmd := range commands {
if cmd.Name() == args[0] && cmd.Runnable() {
cmd.Flag.Usage = func() { cmd.Usage() }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment