From f5b997bfc4c77ef262726d14b30d387eb7acd1c6 Mon Sep 17 00:00:00 2001 From: Peter Stone Date: Sun, 25 Jan 2026 20:55:58 -1000 Subject: Fix all static analysis errors (golangci-lint) - Fix errcheck: handle all error return values in production code - Fix errcheck: handle all error return values in test files - Fix staticcheck: replace deprecated WithCredentialsFile with WithAuthCredentialsFile - Remove unused code: authHeaders, planToEatPlannerItem, planToEatResponse - Use defer func() { _ = x.Close() }() pattern for ignored close errors Co-Authored-By: Claude Opus 4.5 --- internal/handlers/handlers.go | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) (limited to 'internal/handlers/handlers.go') diff --git a/internal/handlers/handlers.go b/internal/handlers/handlers.go index e0e185d..a169478 100644 --- a/internal/handlers/handlers.go +++ b/internal/handlers/handlers.go @@ -659,9 +659,9 @@ func (h *Handler) handleAtomToggle(w http.ResponseWriter, r *http.Request, compl // Remove from local cache switch source { case "todoist": - h.store.DeleteTask(id) + _ = h.store.DeleteTask(id) case "trello": - h.store.DeleteCard(id) + _ = h.store.DeleteCard(id) } // Return completed task HTML with uncomplete option @@ -675,9 +675,9 @@ func (h *Handler) handleAtomToggle(w http.ResponseWriter, r *http.Request, compl // Invalidate cache to force refresh switch source { case "todoist": - h.store.InvalidateCache(store.CacheKeyTodoistTasks) + _ = h.store.InvalidateCache(store.CacheKeyTodoistTasks) case "trello": - h.store.InvalidateCache(store.CacheKeyTrelloBoards) + _ = h.store.InvalidateCache(store.CacheKeyTrelloBoards) } // Don't swap empty response - just trigger refresh w.Header().Set("HX-Reswap", "none") @@ -710,10 +710,11 @@ func (h *Handler) getAtomTitle(id, source string) string { case "bug": if bugs, err := h.store.GetBugs(); err == nil { var bugID int64 - fmt.Sscanf(id, "bug-%d", &bugID) - for _, b := range bugs { - if b.ID == bugID { - return b.Description + if _, err := fmt.Sscanf(id, "bug-%d", &bugID); err == nil { + for _, b := range bugs { + if b.ID == bugID { + return b.Description + } } } } @@ -752,7 +753,7 @@ func (h *Handler) HandleUnifiedAdd(w http.ResponseWriter, r *http.Request) { JSONError(w, http.StatusInternalServerError, "Failed to create Todoist task", err) return } - h.store.InvalidateCache(store.CacheKeyTodoistTasks) + _ = h.store.InvalidateCache(store.CacheKeyTodoistTasks) case "trello": listID := r.FormValue("list_id") @@ -764,7 +765,7 @@ func (h *Handler) HandleUnifiedAdd(w http.ResponseWriter, r *http.Request) { JSONError(w, http.StatusInternalServerError, "Failed to create Trello card", err) return } - h.store.InvalidateCache(store.CacheKeyTrelloBoards) + _ = h.store.InvalidateCache(store.CacheKeyTrelloBoards) default: JSONError(w, http.StatusBadRequest, "Invalid source", nil) @@ -791,7 +792,7 @@ func (h *Handler) HandleGetListsOptions(w http.ResponseWriter, r *http.Request) w.Header().Set("Content-Type", "text/html") for _, list := range lists { - fmt.Fprintf(w, ``, list.ID, list.Name) + _, _ = fmt.Fprintf(w, ``, list.ID, list.Name) } } @@ -805,12 +806,12 @@ func (h *Handler) HandleGetBugs(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "text/html") if len(bugs) == 0 { - fmt.Fprint(w, `

No bugs reported yet.

`) + _, _ = fmt.Fprint(w, `

No bugs reported yet.

`) return } for _, bug := range bugs { - fmt.Fprintf(w, `
+ _, _ = fmt.Fprintf(w, `

%s

%s

`, template.HTMLEscapeString(bug.Description), bug.CreatedAt.Format("Jan 2, 3:04 PM")) @@ -916,7 +917,7 @@ func (h *Handler) HandleGetShoppingLists(w http.ResponseWriter, r *http.Request) w.Header().Set("Content-Type", "text/html") for _, list := range lists { - fmt.Fprintf(w, ``, list.ID, list.Name) + _, _ = fmt.Fprintf(w, ``, list.ID, list.Name) } } -- cgit v1.2.3