aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/go/internal/envcmd/env.go
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2017-11-01 13:31:44 -0400
committerRuss Cox <rsc@golang.org>2017-11-03 17:45:09 +0000
commitefb1a7524eda6c36efdb506d0f9e8d822808593e (patch)
treee42a51c4ed0aabdc8a7aba37b5e7df0ed3e7b125 /src/cmd/go/internal/envcmd/env.go
parent2ff3e9c8d84b22bf88190e77014bbadb974b833c (diff)
downloadgo-efb1a7524eda6c36efdb506d0f9e8d822808593e.tar.gz
go-efb1a7524eda6c36efdb506d0f9e8d822808593e.zip
cmd/go: prefer $GOTMPDIR over operating system tmp dir for temp files
We build and run executables in the work directory, and some users have $TMPDIR set noexec. Fixes #8451. Change-Id: I76bf2ddec84e9cb37ad9a6feb53a1a84b47aa263 Reviewed-on: https://go-review.googlesource.com/75475 Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: David Crawshaw <crawshaw@golang.org>
Diffstat (limited to 'src/cmd/go/internal/envcmd/env.go')
-rw-r--r--src/cmd/go/internal/envcmd/env.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/cmd/go/internal/envcmd/env.go b/src/cmd/go/internal/envcmd/env.go
index cd3f9000c2..90ab2d718f 100644
--- a/src/cmd/go/internal/envcmd/env.go
+++ b/src/cmd/go/internal/envcmd/env.go
@@ -32,6 +32,8 @@ each named variable on its own line.
The -json flag prints the environment in JSON format
instead of as a shell script.
+
+For more about environment variables, see 'go help environment'.
`,
}
@@ -48,6 +50,7 @@ func MkEnv() []cfg.EnvVar {
env := []cfg.EnvVar{
{Name: "GOARCH", Value: cfg.Goarch},
{Name: "GOBIN", Value: cfg.GOBIN},
+ {Name: "GOCACHE", Value: cache.DefaultDir()},
{Name: "GOEXE", Value: cfg.ExeSuffix},
{Name: "GOHOSTARCH", Value: runtime.GOARCH},
{Name: "GOHOSTOS", Value: runtime.GOOS},
@@ -55,8 +58,8 @@ func MkEnv() []cfg.EnvVar {
{Name: "GOPATH", Value: cfg.BuildContext.GOPATH},
{Name: "GORACE", Value: os.Getenv("GORACE")},
{Name: "GOROOT", Value: cfg.GOROOT},
+ {Name: "GOTMPDIR", Value: os.Getenv("GOTMPDIR")},
{Name: "GOTOOLDIR", Value: base.ToolDir},
- {Name: "GOCACHE", Value: cache.DefaultDir()},
// disable escape codes in clang errors
{Name: "TERM", Value: "dumb"},