mirror of https://github.com/goproxyio/goproxy
support multiple GOPATH
parent
18041af8bd
commit
6aca89fe84
7
main.go
7
main.go
|
@ -22,11 +22,12 @@ func init() {
|
|||
}
|
||||
|
||||
func main() {
|
||||
gp := os.Getenv("GOPATH")
|
||||
if gp == "" {
|
||||
gpEnv := os.Getenv("GOPATH")
|
||||
if gpEnv == "" {
|
||||
panic("can not find $GOPATH")
|
||||
}
|
||||
cacheDir = filepath.Join(gp, "pkg", "mod", "cache", "download")
|
||||
gp := filepath.SplitList(gpEnv)
|
||||
cacheDir = filepath.Join(gp[0], "pkg", "mod", "cache", "download")
|
||||
http.Handle("/", mainHandler(http.FileServer(http.Dir(cacheDir))))
|
||||
err := http.ListenAndServe(listen, nil)
|
||||
if nil != err {
|
||||
|
|
Loading…
Reference in New Issue