lint: unchecked errors

This commit is contained in:
Umputun
2018-05-18 01:58:40 -05:00
parent 8b1ebfdf4f
commit 8b06c7134f
+8 -2
View File
@@ -54,7 +54,11 @@ func (p Image) Routes() chi.Router {
rest.SendErrorJSON(w, r, http.StatusBadRequest, err, "can't get image "+string(src))
return
}
defer resp.Body.Close()
defer func() {
if e := resp.Body.Close(); e != nil {
log.Printf("[WARN] can't close body, %s", e)
}
}()
for k, v := range resp.Header {
if strings.EqualFold(k, "Content-Type") {
@@ -74,7 +78,9 @@ func (p Image) Routes() chi.Router {
return
}
}
io.Copy(w, resp.Body)
if _, e := io.Copy(w, resp.Body); e != nil {
log.Printf("[WARN] can't copy image stream, %s", e)
}
})
return router
}