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/api/todoist_test.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'internal/api/todoist_test.go') diff --git a/internal/api/todoist_test.go b/internal/api/todoist_test.go index 2fa6e28..7bbcc1e 100644 --- a/internal/api/todoist_test.go +++ b/internal/api/todoist_test.go @@ -13,7 +13,7 @@ import ( // newTestTodoistClient creates a TodoistClient for testing with custom base URL func newTestTodoistClient(baseURL, apiKey string) *TodoistClient { client := NewTodoistClient(apiKey) - client.BaseClient.BaseURL = baseURL + client.BaseURL = baseURL client.syncClient.BaseURL = baseURL return client } @@ -62,7 +62,7 @@ func TestTodoistClient_CreateTask(t *testing.T) { } w.Header().Set("Content-Type", "application/json") - json.NewEncoder(w).Encode(response) + _ = json.NewEncoder(w).Encode(response) })) defer server.Close() @@ -96,7 +96,7 @@ func TestTodoistClient_CreateTask_WithDueDate(t *testing.T) { server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { // Parse JSON body var payload map[string]interface{} - json.NewDecoder(r.Body).Decode(&payload) + _ = json.NewDecoder(r.Body).Decode(&payload) // Verify due_date if payload["due_date"] != "2026-01-15" { @@ -117,7 +117,7 @@ func TestTodoistClient_CreateTask_WithDueDate(t *testing.T) { } w.Header().Set("Content-Type", "application/json") - json.NewEncoder(w).Encode(response) + _ = json.NewEncoder(w).Encode(response) })) defer server.Close() @@ -181,7 +181,7 @@ func TestTodoistClient_CompleteTask_Error(t *testing.T) { // Mock server that returns error server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusNotFound) - w.Write([]byte(`{"error":"Task not found"}`)) + _, _ = w.Write([]byte(`{"error":"Task not found"}`)) })) defer server.Close() @@ -218,7 +218,7 @@ func TestTodoistClient_GetProjects(t *testing.T) { } w.Header().Set("Content-Type", "application/json") - json.NewEncoder(w).Encode(response) + _ = json.NewEncoder(w).Encode(response) })) defer server.Close() -- cgit v1.2.3