playground: put GOCACHE in temp dir
Fixes golang/go#30473
Change-Id: Iad5b60b98c12add932fa3be9174fe7ca4dcbb6b2
Reviewed-on: https://go-review.googlesource.com/c/164519
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
diff --git a/Dockerfile b/Dockerfile
index c196207..c6390fc 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -222,10 +222,6 @@
COPY --from=builder /usr/local/go /usr/local/go
COPY --from=builder /tmp/sel_ldr_x86_64 /usr/local/bin
-# For implicit GOCACHE (issues 29243 and 29251), set HOME:
-RUN mkdir -p /home/gopher
-ENV HOME /home/gopher
-
ENV GOPATH /go
ENV PATH /usr/local/go/bin:$GOPATH/bin:$PATH
diff --git a/sandbox.go b/sandbox.go
index 8e21a96..7493213 100644
--- a/sandbox.go
+++ b/sandbox.go
@@ -323,8 +323,9 @@
}
exe := filepath.Join(tmpDir, "a.out")
+ goCache := filepath.Join(tmpDir, "gocache")
cmd := exec.Command("go", "build", "-o", exe, in)
- cmd.Env = []string{"GOOS=nacl", "GOARCH=amd64p32", "GOPATH=" + os.Getenv("GOPATH"), "HOME=" + os.Getenv("HOME")}
+ cmd.Env = []string{"GOOS=nacl", "GOARCH=amd64p32", "GOPATH=" + os.Getenv("GOPATH"), "GOCACHE=" + goCache}
if out, err := cmd.CombinedOutput(); err != nil {
if _, ok := err.(*exec.ExitError); ok {
// Return compile errors to the user.