summaryrefslogtreecommitdiff
path: root/src/cmd/go/internal/base
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2019-04-08 11:23:42 -0400
committerRuss Cox <rsc@golang.org>2019-04-23 00:58:08 +0000
commitf0e97546962736fe4aa73b7c7ed590f0134515e1 (patch)
treed6903cc240c0cdef29bcd0d7fa3b059eab080a17 /src/cmd/go/internal/base
parente40dffe55ac0ec40fc325bf9ef03dde297fcc2c0 (diff)
downloadgo-git-f0e97546962736fe4aa73b7c7ed590f0134515e1.tar.gz
cmd/go: add env -w and env -u to set and unset default env vars
Setting environment variables for go command configuration is too difficult and system-specific. This CL adds go env -w, to change the default settings more easily, in a portable way. It also adds go env -u, to unset those changes. See https://golang.org/design/30411-env for details. Fixes #30411. Change-Id: I36e83f55b666459f8f7f482432a4a6ee015da71d Reviewed-on: https://go-review.googlesource.com/c/go/+/171137 Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com>
Diffstat (limited to 'src/cmd/go/internal/base')
-rw-r--r--src/cmd/go/internal/base/goflags.go3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/cmd/go/internal/base/goflags.go b/src/cmd/go/internal/base/goflags.go
index 2f50b50bfc..187c2a1472 100644
--- a/src/cmd/go/internal/base/goflags.go
+++ b/src/cmd/go/internal/base/goflags.go
@@ -7,7 +7,6 @@ package base
import (
"flag"
"fmt"
- "os"
"runtime"
"strings"
@@ -62,7 +61,7 @@ func InitGOFLAGS() {
// (Both will show the GOFLAGS setting if let succeed.)
hideErrors := cfg.CmdName == "env" || cfg.CmdName == "bug"
- goflags = strings.Fields(os.Getenv("GOFLAGS"))
+ goflags = strings.Fields(cfg.Getenv("GOFLAGS"))
if goflags == nil {
goflags = []string{} // avoid work on later InitGOFLAGS call
}