]> Cypherpunks repositories - gostls13.git/commit
cmd/go: allow configuring module cache directory with GOMODCACHE
authorMichael Matloob <matloob@golang.org>
Fri, 14 Feb 2020 22:44:00 +0000 (17:44 -0500)
committerMichael Matloob <matloob@golang.org>
Wed, 8 Apr 2020 17:51:12 +0000 (17:51 +0000)
commitc4f2a9788a7be04daf931ac54382fbe2cb754938
treed366d8231efbf978530ee03984b87e9537a27062
parent97711bfd60575b2f51e212b0b5181729597e9091
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>
15 files changed:
src/cmd/go/internal/cfg/cfg.go
src/cmd/go/internal/clean/clean.go
src/cmd/go/internal/envcmd/env.go
src/cmd/go/internal/modconv/convert_test.go
src/cmd/go/internal/modfetch/cache.go
src/cmd/go/internal/modfetch/codehost/codehost.go
src/cmd/go/internal/modfetch/codehost/git_test.go
src/cmd/go/internal/modfetch/codehost/shell.go
src/cmd/go/internal/modfetch/coderepo_test.go
src/cmd/go/internal/modfetch/fetch.go
src/cmd/go/internal/modfetch/sumdb.go
src/cmd/go/internal/modload/init.go
src/cmd/go/internal/modload/query_test.go
src/cmd/go/testdata/script/mod_gomodcache.txt [new file with mode: 0644]
src/internal/cfg/cfg.go