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 != "" {
|
||||
os.Setenv("GOPRIVATE", excludeHost)
|
||||
}
|
||||
|
||||
downloadRoot = getDownloadRoot()
|
||||
}
|
||||
|
||||
func main() {
|
||||
|
@ -80,7 +82,7 @@ func main() {
|
|||
handle = &logger{proxy.NewRouter(proxy.NewServer(new(ops)), &proxy.RouterOptions{
|
||||
Pattern: excludeHost,
|
||||
Proxy: proxyHost,
|
||||
DownloadRoot: getDownloadRoot(),
|
||||
DownloadRoot: downloadRoot,
|
||||
})}
|
||||
} else {
|
||||
handle = &logger{proxy.NewServer(new(ops))}
|
||||
|
@ -113,9 +115,8 @@ func getDownloadRoot() string {
|
|||
GOPATH string
|
||||
}
|
||||
if cacheDir != "" {
|
||||
downloadRoot = filepath.Join(cacheDir, "pkg/mod/cache/download")
|
||||
os.Setenv("GOPATH", cacheDir)
|
||||
return downloadRoot
|
||||
return filepath.Join(cacheDir, "pkg/mod/cache/download")
|
||||
}
|
||||
if err := goJSON(&env, "go", "env", "-json", "GOPATH"); err != nil {
|
||||
log.Fatal(err)
|
||||
|
|
Loading…
Reference in New Issue