diff options
| author | Peter Stone <thepeterstone@gmail.com> | 2026-01-25 20:55:58 -1000 |
|---|---|---|
| committer | Peter Stone <thepeterstone@gmail.com> | 2026-01-25 20:55:58 -1000 |
| commit | f5b997bfc4c77ef262726d14b30d387eb7acd1c6 (patch) | |
| tree | 740879da10f3ddcd62bf276cd0632134b53a23c8 /internal/handlers/handlers.go | |
| parent | fa95c71494458070b78270e3d9170076028fc974 (diff) | |
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 <noreply@anthropic.com>
Diffstat (limited to 'internal/handlers/handlers.go')
| -rw-r--r-- | internal/handlers/handlers.go | 29 |
1 files changed, 15 insertions, 14 deletions
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, `<option value="%s">%s</option>`, list.ID, list.Name) + _, _ = fmt.Fprintf(w, `<option value="%s">%s</option>`, 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, `<p class="text-gray-500 text-sm">No bugs reported yet.</p>`) + _, _ = fmt.Fprint(w, `<p class="text-gray-500 text-sm">No bugs reported yet.</p>`) return } for _, bug := range bugs { - fmt.Fprintf(w, `<div class="text-sm border-b border-gray-100 py-2"> + _, _ = fmt.Fprintf(w, `<div class="text-sm border-b border-gray-100 py-2"> <p class="text-gray-900">%s</p> <p class="text-gray-400 text-xs">%s</p> </div>`, 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, `<option value="%s">%s</option>`, list.ID, list.Name) + _, _ = fmt.Fprintf(w, `<option value="%s">%s</option>`, list.ID, list.Name) } } |
