From 8b06c7134fa8ccbb759787e11cfd637da1b1cb97 Mon Sep 17 00:00:00 2001 From: Umputun Date: Fri, 18 May 2018 01:58:40 -0500 Subject: [PATCH] lint: unchecked errors --- app/rest/proxy/image.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/rest/proxy/image.go b/app/rest/proxy/image.go index f65a8a70..b8f64128 100644 --- a/app/rest/proxy/image.go +++ b/app/rest/proxy/image.go @@ -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 }