Fix all errcheck warnings

This commit is contained in:
Deluan
2020-04-26 12:35:26 -04:00
committed by Deluan Quintão
parent 03c3c192ed
commit 5cd453afeb
14 changed files with 37 additions and 38 deletions
+4 -2
View File
@@ -162,7 +162,7 @@ func H(r chi.Router, path string, f Handler) {
func HGone(r chi.Router, path string) {
handle := func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(410)
w.Write([]byte("This endpoint will not be implemented"))
_, _ = w.Write([]byte("This endpoint will not be implemented"))
}
r.HandleFunc("/"+path, handle)
r.HandleFunc("/"+path+".view", handle)
@@ -207,5 +207,7 @@ func SendResponse(w http.ResponseWriter, r *http.Request, payload *responses.Sub
} else {
log.Warn(r.Context(), "API: Failed response", "error", payload.Error.Code, "message", payload.Error.Message)
}
w.Write(response)
if _, err := w.Write(response); err != nil {
log.Error(r, "Error sending response to client", "payload", string(response), err)
}
}
+1 -1
View File
@@ -27,7 +27,7 @@ func (c *MediaRetrievalController) GetAvatar(w http.ResponseWriter, r *http.Requ
return nil, NewError(responses.ErrorDataNotFound, "Avatar image not found")
}
defer f.Close()
io.Copy(w, f)
_, _ = io.Copy(w, f)
return nil, nil
}
+2 -2
View File
@@ -24,8 +24,8 @@ func (c *fakeCover) Get(ctx context.Context, id string, size int, out io.Writer)
}
c.recvId = id
c.recvSize = size
out.Write([]byte(c.data))
return nil
_, err := out.Write([]byte(c.data))
return err
}
var _ = Describe("MediaRetrievalController", func() {