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/store/sqlite_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/store/sqlite_test.go')
| -rw-r--r-- | internal/store/sqlite_test.go | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/internal/store/sqlite_test.go b/internal/store/sqlite_test.go index fc8a3b7..9aef09d 100644 --- a/internal/store/sqlite_test.go +++ b/internal/store/sqlite_test.go @@ -125,7 +125,7 @@ func setupTestStoreWithMeals(t *testing.T) *Store { // TestDeleteTask verifies that DeleteTask removes a task from the cache func TestDeleteTask(t *testing.T) { store := setupTestStoreWithTasks(t) - defer store.Close() + defer func() { _ = store.Close() }() // Save some tasks tasks := []models.Task{ @@ -213,7 +213,7 @@ func TestDeleteTask(t *testing.T) { // TestDeleteTask_NonExistent verifies that deleting a non-existent task doesn't error func TestDeleteTask_NonExistent(t *testing.T) { store := setupTestStoreWithTasks(t) - defer store.Close() + defer func() { _ = store.Close() }() // Delete a task that doesn't exist - should not error err := store.DeleteTask("nonexistent") @@ -225,7 +225,7 @@ func TestDeleteTask_NonExistent(t *testing.T) { // TestDeleteCard verifies that DeleteCard removes a card from the cache func TestDeleteCard(t *testing.T) { store := setupTestStoreWithCards(t) - defer store.Close() + defer func() { _ = store.Close() }() // First create a board _, err := store.db.Exec(`INSERT INTO boards (id, name) VALUES (?, ?)`, "board1", "Test Board") @@ -292,7 +292,7 @@ func TestDeleteCard(t *testing.T) { // TestDeleteCard_NonExistent verifies that deleting a non-existent card doesn't error func TestDeleteCard_NonExistent(t *testing.T) { store := setupTestStoreWithCards(t) - defer store.Close() + defer func() { _ = store.Close() }() // Delete a card that doesn't exist - should not error err := store.DeleteCard("nonexistent") @@ -306,7 +306,7 @@ func TestDeleteCard_NonExistent(t *testing.T) { // where pointers in boardMap became stale when the boards slice grew. func TestSaveAndGetBoards_MultipleBoards(t *testing.T) { store := setupTestStoreWithCards(t) - defer store.Close() + defer func() { _ = store.Close() }() // Create multiple boards with varying numbers of cards // Use enough boards to trigger slice reallocation @@ -411,7 +411,7 @@ func TestSaveAndGetBoards_MultipleBoards(t *testing.T) { // to ensure slice reallocation is thoroughly tested func TestSaveAndGetBoards_ManyBoards(t *testing.T) { store := setupTestStoreWithCards(t) - defer store.Close() + defer func() { _ = store.Close() }() // Create 20 boards with 5 cards each = 100 cards total numBoards := 20 @@ -466,7 +466,7 @@ func TestSaveAndGetBoards_ManyBoards(t *testing.T) { func TestGetTasksByDateRange(t *testing.T) { store := setupTestStoreWithTasks(t) - defer store.Close() + defer func() { _ = store.Close() }() now := time.Now() tomorrow := now.Add(24 * time.Hour) @@ -498,7 +498,7 @@ func TestGetTasksByDateRange(t *testing.T) { func TestGetMealsByDateRange(t *testing.T) { store := setupTestStoreWithMeals(t) - defer store.Close() + defer func() { _ = store.Close() }() now := time.Now() tomorrow := now.Add(24 * time.Hour) @@ -530,7 +530,7 @@ func TestGetMealsByDateRange(t *testing.T) { func TestGetCardsByDateRange(t *testing.T) { store := setupTestStoreWithCards(t) - defer store.Close() + defer func() { _ = store.Close() }() now := time.Now() tomorrow := now.Add(24 * time.Hour) @@ -603,7 +603,7 @@ func setupTestStoreWithBugs(t *testing.T) *Store { func TestBugResolution(t *testing.T) { store := setupTestStoreWithBugs(t) - defer store.Close() + defer func() { _ = store.Close() }() // Save some bugs if err := store.SaveBug("Bug 1"); err != nil { @@ -681,7 +681,7 @@ func TestBugResolution(t *testing.T) { func TestResolveBug_NonExistent(t *testing.T) { store := setupTestStoreWithBugs(t) - defer store.Close() + defer func() { _ = store.Close() }() // Resolving a non-existent bug should not error (no rows affected is fine) err := store.ResolveBug(999) |
