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>
This commit is contained in:
Heschi Kreinick 2020-10-26 16:00:07 -04:00
parent c8cfbd0f21
commit e84cfc6dd5
2 changed files with 2 additions and 0 deletions

View File

@ -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",
)

View File

@ -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),