lint: err check on writer close

This commit is contained in:
Umputun
2018-05-25 14:42:56 -05:00
parent 232f0df03f
commit 5280478c32
+5 -1
View File
@@ -106,7 +106,11 @@ func (a *admin) exportCtrl(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Disposition", "attachment;filename="+exportFile)
w.WriteHeader(http.StatusOK)
gzWriter := gzip.NewWriter(w)
defer gzWriter.Close()
defer func() {
if e := gzWriter.Close(); e != nil {
log.Printf("[WARN] can't close gzip writer, %s", e)
}
}()
writer = gzWriter
}