mirror of https://github.com/goproxyio/goproxy
fix: fix module cache dir
parent
504ed26fe3
commit
b66f9f4b2c
4
main.go
4
main.go
|
@ -72,7 +72,6 @@ func init() {
|
||||||
os.Setenv("GOSUMDB", "off")
|
os.Setenv("GOSUMDB", "off")
|
||||||
|
|
||||||
downloadRoot = getDownloadRoot()
|
downloadRoot = getDownloadRoot()
|
||||||
os.Setenv("GOMODCACHE", downloadRoot)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
@ -121,7 +120,7 @@ func getDownloadRoot() string {
|
||||||
GOPATH string
|
GOPATH string
|
||||||
}
|
}
|
||||||
if cacheDir != "" {
|
if cacheDir != "" {
|
||||||
os.Setenv("GOPATH", cacheDir)
|
os.Setenv("GOMODCACHE", filepath.Join(cacheDir, "pkg", "mod"))
|
||||||
return filepath.Join(cacheDir, "pkg", "mod", "cache", "download")
|
return filepath.Join(cacheDir, "pkg", "mod", "cache", "download")
|
||||||
}
|
}
|
||||||
if err := goJSON(&env, "go", "env", "-json", "GOPATH"); err != nil {
|
if err := goJSON(&env, "go", "env", "-json", "GOPATH"); err != nil {
|
||||||
|
@ -131,6 +130,7 @@ func getDownloadRoot() string {
|
||||||
if len(list) == 0 || list[0] == "" {
|
if len(list) == 0 || list[0] == "" {
|
||||||
log.Fatalf("missing $GOPATH")
|
log.Fatalf("missing $GOPATH")
|
||||||
}
|
}
|
||||||
|
os.Setenv("GOMODCACHE", filepath.Join(list[0], "pkg", "mod"))
|
||||||
return filepath.Join(list[0], "pkg", "mod", "cache", "download")
|
return filepath.Join(list[0], "pkg", "mod", "cache", "download")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue