mirror of https://github.com/goproxyio/goproxy
修复缓存目录无用
parent
5a68b8fe9c
commit
389bbbec05
7
main.go
7
main.go
|
@ -65,6 +65,8 @@ func init() {
|
||||||
if excludeHost != "" {
|
if excludeHost != "" {
|
||||||
os.Setenv("GOPRIVATE", excludeHost)
|
os.Setenv("GOPRIVATE", excludeHost)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
downloadRoot = getDownloadRoot()
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
@ -80,7 +82,7 @@ func main() {
|
||||||
handle = &logger{proxy.NewRouter(proxy.NewServer(new(ops)), &proxy.RouterOptions{
|
handle = &logger{proxy.NewRouter(proxy.NewServer(new(ops)), &proxy.RouterOptions{
|
||||||
Pattern: excludeHost,
|
Pattern: excludeHost,
|
||||||
Proxy: proxyHost,
|
Proxy: proxyHost,
|
||||||
DownloadRoot: getDownloadRoot(),
|
DownloadRoot: downloadRoot,
|
||||||
})}
|
})}
|
||||||
} else {
|
} else {
|
||||||
handle = &logger{proxy.NewServer(new(ops))}
|
handle = &logger{proxy.NewServer(new(ops))}
|
||||||
|
@ -113,9 +115,8 @@ func getDownloadRoot() string {
|
||||||
GOPATH string
|
GOPATH string
|
||||||
}
|
}
|
||||||
if cacheDir != "" {
|
if cacheDir != "" {
|
||||||
downloadRoot = filepath.Join(cacheDir, "pkg/mod/cache/download")
|
|
||||||
os.Setenv("GOPATH", cacheDir)
|
os.Setenv("GOPATH", cacheDir)
|
||||||
return downloadRoot
|
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 {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
|
|
Loading…
Reference in New Issue