Fixes thanks to go vet

This commit is contained in:
nemunaire 2018-02-16 10:50:44 +01:00 committed by nemunaire
parent 4b538cdea8
commit 0ec90b14c6
4 changed files with 20 additions and 7 deletions

View file

@ -24,12 +24,9 @@ func apiHandler(f DispatchFunction) func(http.ResponseWriter, *http.Request, htt
}
log.Printf("%s \"%s %s\" [%s]\n", r.RemoteAddr, r.Method, r.URL.Path, r.UserAgent())
var ret interface{}
var err error = nil
// Read the body
if r.ContentLength < 0 || r.ContentLength > 6553600 {
http.Error(w, fmt.Sprintf("{errmsg:\"Request too large or request size unknown\"}", err), http.StatusRequestEntityTooLarge)
http.Error(w, fmt.Sprintf("{errmsg:\"Request too large or request size unknown\"}"), http.StatusRequestEntityTooLarge)
return
}
var body []byte
@ -46,6 +43,9 @@ func apiHandler(f DispatchFunction) func(http.ResponseWriter, *http.Request, htt
}
}
var ret interface{}
var err error = nil
ret, err = f(ps, body)
// Format response