lint: fix errcheck for Close and Write calls across multiple files

Use lint.LogOnErr for deferred Body/File/Client Close calls.
Use lint.Write for unchecked w.Write calls.
Fix bug in sync/sms.go where fmt.Errorf result was discarded
(replace with proper log.Error call).
This commit is contained in:
Eli Ribble 2026-05-09 02:29:07 +00:00
parent c7a7e8431c
commit 0ec810591e
No known key found for this signature in database
9 changed files with 24 additions and 15 deletions

View file

@ -5,6 +5,7 @@ import (
"github.com/Gleipnir-Technology/nidus-sync/db"
"github.com/Gleipnir-Technology/nidus-sync/db/models"
"github.com/Gleipnir-Technology/nidus-sync/lint"
"github.com/Gleipnir-Technology/nidus-sync/html"
"github.com/Gleipnir-Technology/nidus-sync/platform/email"
"github.com/aarondl/opt/omit"
@ -36,7 +37,7 @@ func getEmailByCode(w http.ResponseWriter, r *http.Request) {
respondError(w, "Failed to render email_log: %w", err, http.StatusInternalServerError)
return
}
w.Write(html)
lint.Write(w, html)
}
func getEmailReportUnsubscribe(w http.ResponseWriter, r *http.Request) {
email := r.FormValue("email")

View file

@ -6,6 +6,8 @@ import (
"net/http"
"os"
"github.com/Gleipnir-Technology/nidus-sync/lint"
"github.com/gorilla/mux"
"github.com/rs/zerolog/log"
)
@ -20,7 +22,7 @@ func getScssDebug(w http.ResponseWriter, r *http.Request) {
respondError(w, "failed to open file", err, http.StatusInternalServerError)
return
}
defer file.Close()
defer lint.LogOnErr(file.Close, "close scss file")
fileInfo, err := file.Stat()
if err != nil {
respondError(w, "failed to stat file", err, http.StatusInternalServerError)