mirror of https://github.com/goproxyio/goproxy
add access log
parent
9a38b201ef
commit
aafa0fc010
4
main.go
4
main.go
|
@ -37,7 +37,7 @@ func main() {
|
|||
|
||||
func mainHandler(inner http.Handler) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
fmt.Fprintf(os.Stdout, "goproxy: download %s\n", r.URL.Path)
|
||||
fmt.Fprintf(os.Stdout, "goproxy: %s download %s\n", r.RemoteAddr, r.URL.Path)
|
||||
if _, err := os.Stat(filepath.Join(cacheDir, r.URL.Path)); err != nil {
|
||||
if strings.HasSuffix(r.URL.Path, ".info") || strings.HasSuffix(r.URL.Path, ".mod") {
|
||||
suffix := ".mod"
|
||||
|
@ -101,7 +101,7 @@ func goGet(path, version, suffix string, w http.ResponseWriter, r *http.Request)
|
|||
}
|
||||
|
||||
if err := cmd.Wait(); err != nil {
|
||||
fmt.Fprintf(os.Stderr, "goproxy: download %s stderr:\n %s", path, string(bytesErr))
|
||||
fmt.Fprintf(os.Stderr, "goproxy: download %s stderr:\n%s", path, string(bytesErr))
|
||||
return err
|
||||
}
|
||||
out := fmt.Sprintf("%s", bytesErr)
|
||||
|
|
Loading…
Reference in New Issue