keep checks for errors in a single line

This commit is contained in:
Steffen Vogel 2021-07-16 11:57:11 +02:00
parent ae4e4173c3
commit 46542e44ec

View File

@ -98,14 +98,12 @@ func (h *graphHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
return
}
_, err = io.Copy(stdin, buf)
if err != nil {
if _, err = io.Copy(stdin, buf); err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
err = stdin.Close()
if err != nil {
if err = stdin.Close(); err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}