diff --git a/server/api.go b/server/api.go index c00f850..e5f5662 100644 --- a/server/api.go +++ b/server/api.go @@ -29,7 +29,7 @@ func apiListMailboxes(w http.ResponseWriter, _ *http.Request) { bytes, _ := json.Marshal(res) w.Header().Add("Content-Type", "application/json") - w.Write(bytes) + _, _ = w.Write(bytes) } func apiListMailbox(w http.ResponseWriter, r *http.Request) { @@ -62,7 +62,7 @@ func apiListMailbox(w http.ResponseWriter, r *http.Request) { bytes, _ := json.Marshal(res) w.Header().Add("Content-Type", "application/json") - w.Write(bytes) + _, _ = w.Write(bytes) } func apiSearchMailbox(w http.ResponseWriter, r *http.Request) { @@ -102,7 +102,7 @@ func apiSearchMailbox(w http.ResponseWriter, r *http.Request) { bytes, _ := json.Marshal(res) w.Header().Add("Content-Type", "application/json") - w.Write(bytes) + _, _ = w.Write(bytes) } // Open a message @@ -120,7 +120,7 @@ func apiOpenMessage(w http.ResponseWriter, r *http.Request) { bytes, _ := json.Marshal(msg) w.Header().Add("Content-Type", "application/json") - w.Write(bytes) + _, _ = w.Write(bytes) } // Download/view an attachment @@ -143,7 +143,7 @@ func apiDownloadAttachment(w http.ResponseWriter, r *http.Request) { w.Header().Add("Content-Type", a.ContentType) w.Header().Set("Content-Disposition", "filename=\""+fileName+"\"") - w.Write(a.Content) + _, _ = w.Write(a.Content) } // View the full email source as plain text @@ -165,7 +165,7 @@ func apiDownloadSource(w http.ResponseWriter, r *http.Request) { if dl == "1" { w.Header().Set("Content-Disposition", "attachment; filename=\""+id+".eml\"") } - w.Write(data) + _, _ = w.Write(data) } // Delete all messages in the mailbox @@ -181,7 +181,7 @@ func apiDeleteAll(w http.ResponseWriter, r *http.Request) { } w.Header().Add("Content-Type", "text/plain") - w.Write([]byte("ok")) + _, _ = w.Write([]byte("ok")) } // Delete a single message @@ -198,7 +198,7 @@ func apiDeleteOne(w http.ResponseWriter, r *http.Request) { } w.Header().Add("Content-Type", "text/plain") - w.Write([]byte("ok")) + _, _ = w.Write([]byte("ok")) } // Mark single message as unread @@ -215,7 +215,7 @@ func apiUnreadOne(w http.ResponseWriter, r *http.Request) { } w.Header().Add("Content-Type", "text/plain") - w.Write([]byte("ok")) + _, _ = w.Write([]byte("ok")) } // Websocket to broadcast changes diff --git a/server/server.go b/server/server.go index 65c111e..8c202a9 100644 --- a/server/server.go +++ b/server/server.go @@ -64,7 +64,7 @@ func Listen() { func basicAuthResponse(w http.ResponseWriter) { w.Header().Set("WWW-Authenticate", `Basic realm="Login"`) w.WriteHeader(http.StatusUnauthorized) - w.Write([]byte("Unauthorised.\n")) + _, _ = w.Write([]byte("Unauthorised.\n")) } type gzipResponseWriter struct { diff --git a/server/websockets/client.go b/server/websockets/client.go index 2b6f0e1..8499dce 100644 --- a/server/websockets/client.go +++ b/server/websockets/client.go @@ -133,5 +133,5 @@ func ServeWs(hub *Hub, w http.ResponseWriter, r *http.Request) { func basicAuthResponse(w http.ResponseWriter) { w.Header().Set("WWW-Authenticate", `Basic realm="Login"`) w.WriteHeader(http.StatusUnauthorized) - w.Write([]byte("Unauthorised.\n")) + _, _ = w.Write([]byte("Unauthorised.\n")) } diff --git a/storage/database.go b/storage/database.go index 4b83004..b2aa8f1 100644 --- a/storage/database.go +++ b/storage/database.go @@ -224,7 +224,7 @@ func Store(mailbox string, b []byte) (string, error) { if err != nil { // delete the summary because the data insert failed logger.Log().Debugf("[db] error inserting raw message, rolling back") - DeleteOneMessage(mailbox, id) + _ = DeleteOneMessage(mailbox, id) return "", err } @@ -567,7 +567,7 @@ func DeleteAllMessages(mailbox string) error { } // resets stats for mailbox - statsRefresh(mailbox) + _ = statsRefresh(mailbox) elapsed := time.Since(totalStart) logger.Log().Infof("Deleted %d messages from %s in %s", totalMessages, mailbox, elapsed) diff --git a/storage/utils.go b/storage/utils.go index 511ffdc..2cd2c19 100644 --- a/storage/utils.go +++ b/storage/utils.go @@ -84,7 +84,7 @@ func pruneCron() { } elapsed := time.Since(start) logger.Log().Infof("Pruned %d messages from %s in %s", limit, m, elapsed) - statsRefresh(m) + _ = statsRefresh(m) if !strings.HasSuffix(m, "_data") { websockets.Broadcast("prune", nil) }