aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/go/internal/modfetch/coderepo_test.go
diff options
context:
space:
mode:
authorMichael Matloob <matloob@golang.org>2020-02-14 17:44:00 -0500
committerMichael Matloob <matloob@golang.org>2020-04-08 17:51:12 +0000
commitc4f2a9788a7be04daf931ac54382fbe2cb754938 (patch)
treed366d8231efbf978530ee03984b87e9537a27062 /src/cmd/go/internal/modfetch/coderepo_test.go
parent97711bfd60575b2f51e212b0b5181729597e9091 (diff)
downloadgo-c4f2a9788a7be04daf931ac54382fbe2cb754938.tar.gz
go-c4f2a9788a7be04daf931ac54382fbe2cb754938.zip
cmd/go: allow configuring module cache directory with GOMODCACHE
Adds a GOMODCACHE environment variable that's used by cmd/go to determine the location of the module cache. The default value of GOMODCACHE will be GOPATH[0]/pkg/mod, the default location of the module cache before this change. Replace the cmd/go/internal/modfetch.PkgMod variable which previously held the location of the module cache with the new cmd/go/internal/cfg.GOMODCACHE variable, for consistency with many of the other environment variables that affect the behavior of cmd/go. (Most of the changes in this CL are due to moving/renaming the variable.) The value of cfg.GOMODCACHE is now set using a variable initializer. It was previously set in cmd/go/internal/modload.Init. The location of GOPATH/pkg/sumdb is unchanged by this CL. While it was previously determined using the value of PkgMod, it now is determined independently dirctly from the value of GOPATH[0]. Fixes #34527 Change-Id: Id4d31d217b3507d6057c8ef7c52af1a0606603e4 Reviewed-on: https://go-review.googlesource.com/c/go/+/219538 Run-TryBot: Michael Matloob <matloob@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com> Reviewed-by: Jay Conrod <jayconrod@google.com>
Diffstat (limited to 'src/cmd/go/internal/modfetch/coderepo_test.go')
-rw-r--r--src/cmd/go/internal/modfetch/coderepo_test.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/cmd/go/internal/modfetch/coderepo_test.go b/src/cmd/go/internal/modfetch/coderepo_test.go
index 39830948fb..f69c193b86 100644
--- a/src/cmd/go/internal/modfetch/coderepo_test.go
+++ b/src/cmd/go/internal/modfetch/coderepo_test.go
@@ -44,7 +44,7 @@ func testMain(m *testing.M) int {
}
defer os.RemoveAll(dir)
- codehost.WorkRoot = dir
+ cfg.GOMODCACHE = dir
return m.Run()
}