mirror of https://github.com/goproxyio/goproxy
fix non-unix OS use Join
parent
970dde4fb9
commit
02f5e37219
6
main.go
6
main.go
|
@ -119,7 +119,7 @@ func getDownloadRoot() string {
|
|||
}
|
||||
if cacheDir != "" {
|
||||
os.Setenv("GOPATH", cacheDir)
|
||||
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 {
|
||||
log.Fatal(err)
|
||||
|
@ -128,7 +128,7 @@ func getDownloadRoot() string {
|
|||
if len(list) == 0 || list[0] == "" {
|
||||
log.Fatalf("missing $GOPATH")
|
||||
}
|
||||
return filepath.Join(list[0], "pkg/mod/cache/download")
|
||||
return filepath.Join(list[0], "pkg", "mod", "cache", "download")
|
||||
}
|
||||
|
||||
// goJSON runs the go command and parses its JSON output into dst.
|
||||
|
@ -177,7 +177,7 @@ func (*ops) List(ctx context.Context, mpath string) (proxy.File, error) {
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
file := filepath.Join(downloadRoot, escMod+"/@v/list")
|
||||
file := filepath.Join(downloadRoot, escMod, "@v", "list")
|
||||
if info, err := os.Stat(file); err == nil && time.Since(info.ModTime()) < listExpire {
|
||||
return os.Open(file)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue