1
0
mirror of https://github.com/golang/go synced 2024-11-19 11:04:47 -07:00

cmd/go: avoid creating new empty environment variables

Broke some tests that assume $GORACE is unset (because it never is).
Those tests are arguably wrong, but this is more robust.

Change-Id: Id56daa160c9e7e01f301c1386791e410bbd5deef
Reviewed-on: https://go-review.googlesource.com/6480
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Russ Cox 2015-03-02 13:49:57 -05:00
parent bfb8ad51d5
commit 8012a2e9c9

View File

@ -158,8 +158,10 @@ func main() {
// but in practice there might be skew // but in practice there might be skew
// This makes sure we all agree. // This makes sure we all agree.
for _, env := range mkEnv() { for _, env := range mkEnv() {
if os.Getenv(env.name) != env.value {
os.Setenv(env.name, env.value) os.Setenv(env.name, env.value)
} }
}
for _, cmd := range commands { for _, cmd := range commands {
if cmd.Name() == args[0] && cmd.Runnable() { if cmd.Name() == args[0] && cmd.Runnable() {