修复缓存目录无用

pull/118/head
formych 2019-09-10 00:50:32 +08:00 committed by kun
parent 5a68b8fe9c
commit 389bbbec05
1 changed files with 4 additions and 3 deletions

View File

@ -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)