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/api/todoist_test.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/api/todoist_test.go')
| -rw-r--r-- | internal/api/todoist_test.go | 12 |
1 files changed, 6 insertions, 6 deletions
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() |
