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/research_test.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'internal/api/research_test.go') diff --git a/internal/api/research_test.go b/internal/api/research_test.go index 83a52b4..f2519e2 100644 --- a/internal/api/research_test.go +++ b/internal/api/research_test.go @@ -45,7 +45,7 @@ func TestTodoistSyncResearch(t *testing.T) { if err != nil { t.Fatalf("Failed to call Sync API: %v", err) } - defer resp.Body.Close() + defer func() { _ = resp.Body.Close() }() body, err := io.ReadAll(resp.Body) if err != nil { @@ -102,13 +102,13 @@ func TestTodoistSyncResearch(t *testing.T) { if err != nil { t.Fatalf("Incremental sync failed: %v", err) } - defer resp2.Body.Close() + defer func() { _ = resp2.Body.Close() }() body2, _ := io.ReadAll(resp2.Body) t.Logf("Incremental response size: %d bytes (vs full: %d bytes)", len(body2), len(body)) var syncResp2 map[string]interface{} - json.Unmarshal(body2, &syncResp2) + _ = json.Unmarshal(body2, &syncResp2) if items2, ok := syncResp2["items"].([]interface{}); ok { t.Logf("Incremental items count: %d", len(items2)) } @@ -142,7 +142,7 @@ func TestTrelloOptimizationResearch(t *testing.T) { t.Fatalf("Failed to fetch boards: %v", err) } body, _ := io.ReadAll(resp.Body) - resp.Body.Close() + _ = resp.Body.Close() fullDuration := time.Since(start) t.Logf("Test 1 - Full boards response:") @@ -150,7 +150,7 @@ func TestTrelloOptimizationResearch(t *testing.T) { t.Logf(" Duration: %v", fullDuration) var boards []map[string]interface{} - json.Unmarshal(body, &boards) + _ = json.Unmarshal(body, &boards) t.Logf(" Board count: %d", len(boards)) if len(boards) > 0 { t.Logf(" Fields in first board: %v", getKeys(boards[0])) @@ -170,7 +170,7 @@ func TestTrelloOptimizationResearch(t *testing.T) { t.Fatalf("Failed to fetch limited boards: %v", err) } body2, _ := io.ReadAll(resp2.Body) - resp2.Body.Close() + _ = resp2.Body.Close() limitedDuration := time.Since(start) t.Logf("\nTest 2 - Limited fields (id,name):") @@ -196,7 +196,7 @@ func TestTrelloOptimizationResearch(t *testing.T) { t.Fatalf("Failed to fetch board with cards: %v", err) } body3, _ := io.ReadAll(resp3.Body) - resp3.Body.Close() + _ = resp3.Body.Close() batchDuration := time.Since(start) t.Logf("\nTest 3 - Single board with cards/lists embedded:") @@ -204,7 +204,7 @@ func TestTrelloOptimizationResearch(t *testing.T) { t.Logf(" Duration: %v", batchDuration) var boardWithCards map[string]interface{} - json.Unmarshal(body3, &boardWithCards) + _ = json.Unmarshal(body3, &boardWithCards) if cards, ok := boardWithCards["cards"].([]interface{}); ok { t.Logf(" Cards count: %d", len(cards)) } @@ -227,7 +227,7 @@ func TestTrelloOptimizationResearch(t *testing.T) { t.Logf(" 'since' parameter: Error - %v", err) } else { body4, _ := io.ReadAll(resp4.Body) - resp4.Body.Close() + _ = resp4.Body.Close() t.Logf(" 'since' parameter: Status %d, Size %d bytes", resp4.StatusCode, len(body4)) } } -- cgit v1.2.3