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() {
|
func main() {
|
||||||
gp := os.Getenv("GOPATH")
|
gpEnv := os.Getenv("GOPATH")
|
||||||
if gp == "" {
|
if gpEnv == "" {
|
||||||
panic("can not find $GOPATH")
|
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))))
|
http.Handle("/", mainHandler(http.FileServer(http.Dir(cacheDir))))
|
||||||
err := http.ListenAndServe(listen, nil)
|
err := http.ListenAndServe(listen, nil)
|
||||||
if nil != err {
|
if nil != err {
|
||||||
|
|
Loading…
Reference in New Issue