summaryrefslogtreecommitdiff
path: root/internal/auth/auth_test.go
diff options
context:
space:
mode:
authorPeter Stone <thepeterstone@gmail.com>2026-01-25 20:55:58 -1000
committerPeter Stone <thepeterstone@gmail.com>2026-01-25 20:55:58 -1000
commitf5b997bfc4c77ef262726d14b30d387eb7acd1c6 (patch)
tree740879da10f3ddcd62bf276cd0632134b53a23c8 /internal/auth/auth_test.go
parentfa95c71494458070b78270e3d9170076028fc974 (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/auth/auth_test.go')
-rw-r--r--internal/auth/auth_test.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/internal/auth/auth_test.go b/internal/auth/auth_test.go
index 505efe3..013a4aa 100644
--- a/internal/auth/auth_test.go
+++ b/internal/auth/auth_test.go
@@ -15,7 +15,7 @@ func TestAuthenticate(t *testing.T) {
if err != nil {
t.Fatalf("an error '%s' was not expected when opening a stub database connection", err)
}
- defer db.Close()
+ defer func() { _ = db.Close() }()
service := NewService(db)
@@ -34,7 +34,7 @@ func TestAuthenticate(t *testing.T) {
t.Errorf("expected no error, got %v", err)
}
if user == nil {
- t.Errorf("expected user, got nil")
+ t.Fatal("expected user, got nil")
}
if user.Username != "testuser" {
t.Errorf("expected username testuser, got %s", user.Username)
@@ -50,7 +50,7 @@ func TestAuthenticate_InvalidCredentials(t *testing.T) {
if err != nil {
t.Fatalf("an error '%s' was not expected when opening a stub database connection", err)
}
- defer db.Close()
+ defer func() { _ = db.Close() }()
service := NewService(db)
@@ -73,7 +73,7 @@ func TestCreateUser(t *testing.T) {
if err != nil {
t.Fatalf("an error '%s' was not expected when opening a stub database connection", err)
}
- defer db.Close()
+ defer func() { _ = db.Close() }()
service := NewService(db)