modules: Set GOCACHE env var
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Wed, 22 Dec 2021 09:53:03 +0000 (10:53 +0100)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Wed, 22 Dec 2021 10:33:59 +0000 (11:33 +0100)
This was introduced in Go 1.15. We do set the GOPATH, which should be enough, but #9309 indicate that's not the case on every platform (GitHub Actions).

Closes #9309

modules/client.go

index 1924cd5b4c6181495721168ca391bd719bbc8126..5b61e5644329938a1759f71a79c3202954811548 100644 (file)
@@ -90,6 +90,8 @@ func NewClient(cfg ClientConfig) *Client {
                "GOPRIVATE", mcfg.Private,
                "GONOPROXY", mcfg.NoProxy,
                "GOPATH", cfg.CacheDir,
+               // GOCACHE was introduced in Go 1.15. This matches the location derived from GOPATH above.
+               "GOCACHE", filepath.Join(cfg.CacheDir, "pkg", "mod"),
        )
 
        logger := cfg.Logger