1
0
mirror of https://github.com/golang/go synced 2024-11-15 10:50:37 -07:00

cmd/dist: set GOPROXY=off when GOPATH is set to be in GOROOT

Avoid downloading modules into a modcache in the GOROOT directory. That
creates read only files in GOROOT, which is undesirable.

Fixes #67463

Change-Id: I6d10c605be5eba967648d823ee8fc915716b4b5b
Reviewed-on: https://go-review.googlesource.com/c/go/+/586078
Reviewed-by: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
Michael Matloob 2024-05-20 10:44:43 -04:00
parent fd54936ea5
commit 80964338a5

View File

@ -1394,6 +1394,12 @@ func cmdbootstrap() {
// go tool may complain. // go tool may complain.
os.Setenv("GOPATH", pathf("%s/pkg/obj/gopath", goroot)) os.Setenv("GOPATH", pathf("%s/pkg/obj/gopath", goroot))
// Set GOPROXY=off to avoid downloading modules to the modcache in
// the GOPATH set above to be inside GOROOT. The modcache is read
// only so if we downloaded to the modcache, we'd create readonly
// files in GOROOT, which is undesirable. See #67463)
os.Setenv("GOPROXY", "off")
// Use a build cache separate from the default user one. // Use a build cache separate from the default user one.
// Also one that will be wiped out during startup, so that // Also one that will be wiped out during startup, so that
// make.bash really does start from a clean slate. // make.bash really does start from a clean slate.