From: Elias Naur Date: Thu, 21 Mar 2019 14:15:40 +0000 (+0100) Subject: misc/ios: don't override GOCACHE on the device X-Git-Tag: go1.13beta1~951 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=7ae8e53de293dd567c1d02dec679f67381c9ace5;p=gostls13.git misc/ios: don't override GOCACHE on the device The iOS exec wrapper copies the environment variables to the binary running on the device. However, some variables such as HOME, TMPDIR and GOCACHE refer to directories that might not be valid on the device. The wrapper already ignores HOME and TMPDIR, but after GO111MODULE was flipped to on for the standard library, cmd/go tests started failing without a valid and writable GOCACHE. It took a while to reproduce because go test does not set an explicit GOCACHE but cmd/dist test does. Fixes #30914 Change-Id: If186cddc5cfd7ad39a0b3eb95f9c64a7d53a27e3 Reviewed-on: https://go-review.googlesource.com/c/go/+/168557 Run-TryBot: Elias Naur TryBot-Result: Gobot Gobot Reviewed-by: Brad Fitzpatrick --- diff --git a/misc/ios/go_darwin_arm_exec.go b/misc/ios/go_darwin_arm_exec.go index 8912d1e8fc..cdf4b07d0a 100644 --- a/misc/ios/go_darwin_arm_exec.go +++ b/misc/ios/go_darwin_arm_exec.go @@ -467,8 +467,8 @@ func idevCmd(cmd *exec.Cmd) *exec.Cmd { func run(appdir, bundleID string, args []string) error { var env []string for _, e := range os.Environ() { - // Don't override TMPDIR, HOME on the device. - if strings.HasPrefix(e, "TMPDIR=") || strings.HasPrefix(e, "HOME=") { + // Don't override TMPDIR, HOME, GOCACHE on the device. + if strings.HasPrefix(e, "TMPDIR=") || strings.HasPrefix(e, "HOME=") || strings.HasPrefix(e, "GOCACHE=") { continue } env = append(env, e)