diff options
author | Heschi Kreinick <heschi@google.com> | 2020-10-26 16:00:07 -0400 |
---|---|---|
committer | Heschi Kreinick <heschi@google.com> | 2020-10-26 22:31:36 +0000 |
commit | e84cfc6dd5ca75e9d39292d939cdb908d60a049e (patch) | |
tree | e5d7bfb965ed4699fd9f4ca42b021c04245b74d7 | |
parent | c8cfbd0f21e6146422c1927945569c9c855a56bc (diff) | |
download | golang-x-tools-e84cfc6dd5ca75e9d39292d939cdb908d60a049e.tar.gz |
all: clear GOMODCACHE in tests
Various test setups set GOPATH expecting that it will affect GOMODCACHE.
If GOMODCACHE is explicitly set in the test's environment, that doesn't
happen. Clear the value out as needed.
Change-Id: I3520d672ace5c1e13783fd078828212bef7d1c01
Reviewed-on: https://go-review.googlesource.com/c/tools/+/265177
Trust: Heschi Kreinick <heschi@google.com>
Run-TryBot: Heschi Kreinick <heschi@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
-rw-r--r-- | go/packages/packagestest/modules.go | 1 | ||||
-rw-r--r-- | internal/imports/mod_test.go | 1 |
2 files changed, 2 insertions, 0 deletions
diff --git a/go/packages/packagestest/modules.go b/go/packages/packagestest/modules.go index 4608766ac..42b62067a 100644 --- a/go/packages/packagestest/modules.go +++ b/go/packages/packagestest/modules.go @@ -163,6 +163,7 @@ func (modules) Finalize(exported *Exported) error { exported.Config.Env = append(exported.Config.Env, "GO111MODULE=on", "GOPATH="+filepath.Join(exported.temp, "modcache"), + "GOMODCACHE=", "GOPROXY="+proxydir.ToURL(modProxyDir), "GOSUMDB=off", ) diff --git a/internal/imports/mod_test.go b/internal/imports/mod_test.go index 5d73c8813..c6bbe56c2 100644 --- a/internal/imports/mod_test.go +++ b/internal/imports/mod_test.go @@ -688,6 +688,7 @@ func setup(t *testing.T, main, wd string) *modTest { env := &ProcessEnv{ Env: map[string]string{ "GOPATH": filepath.Join(dir, "gopath"), + "GOMODCACHE": "", "GO111MODULE": "on", "GOSUMDB": "off", "GOPROXY": proxydir.ToURL(proxyDir), |