http.Error
call without following return GO-W4008Not returning after calling http.Error
in a handler may execute code paths
that should not be executed in case of an error. It is recommended to return
after calling http.Error
.
package main
import (
"net/http"
)
func FooHandler(w http.ResponseWriter, r *http.Request) {
err := ...
if err != nil {
http.Error(w, err, 500)
}
}
package main
import (
"net/http"
)
func FooHandler(w http.ResponseWriter, r *http.Request) {
err := ...
if err != nil {
http.Error(w, err, 500)
return
}
}