diff --git a/internal/db/postgres/aggregator_repo.go b/internal/db/postgres/aggregator_repo.go index 6f205c4..ae5c731 100644 --- a/internal/db/postgres/aggregator_repo.go +++ b/internal/db/postgres/aggregator_repo.go @@ -145,7 +145,7 @@ func (r *postgresAggregatorRepo) GetAggregatorsByDIDs(ctx context.Context, dids if err != nil { return nil, fmt.Errorf("failed to get aggregators: %w", err) } - defer rows.Close() + defer func() { _ = rows.Close() }() var results []*aggregators.Aggregator for rows.Next() { @@ -279,7 +279,7 @@ func (r *postgresAggregatorRepo) ListAggregators(ctx context.Context, limit, off if err != nil { return nil, fmt.Errorf("failed to list aggregators: %w", err) } - defer rows.Close() + defer func() { _ = rows.Close() }() var aggs []*aggregators.Aggregator for rows.Next() { @@ -632,7 +632,7 @@ func (r *postgresAggregatorRepo) ListAuthorizationsForAggregator(ctx context.Con if err != nil { return nil, fmt.Errorf("failed to list authorizations for aggregator: %w", err) } - defer rows.Close() + defer func() { _ = rows.Close() }() return scanAuthorizations(rows) } @@ -662,7 +662,7 @@ func (r *postgresAggregatorRepo) ListAuthorizationsForCommunity(ctx context.Cont if err != nil { return nil, fmt.Errorf("failed to list authorizations for community: %w", err) } - defer rows.Close() + defer func() { _ = rows.Close() }() return scanAuthorizations(rows) } @@ -730,7 +730,7 @@ func (r *postgresAggregatorRepo) GetRecentPosts(ctx context.Context, aggregatorD if err != nil { return nil, fmt.Errorf("failed to get recent posts: %w", err) } - defer rows.Close() + defer func() { _ = rows.Close() }() var posts []*aggregators.AggregatorPost for rows.Next() { diff --git a/internal/db/postgres/vote_repo.go b/internal/db/postgres/vote_repo.go index bf13b96..166c8ae 100644 --- a/internal/db/postgres/vote_repo.go +++ b/internal/db/postgres/vote_repo.go @@ -96,7 +96,7 @@ func (r *postgresVoteRepo) GetByURI(ctx context.Context, uri string) (*votes.Vot // GetByVoterAndSubject retrieves a user's vote on a specific subject // Used by service to check existing vote state before creating/toggling -func (r *postgresVoteRepo) GetByVoterAndSubject(ctx context.Context, voterDID string, subjectURI string) (*votes.Vote, error) { +func (r *postgresVoteRepo) GetByVoterAndSubject(ctx context.Context, voterDID, subjectURI string) (*votes.Vote, error) { query := ` SELECT id, uri, cid, rkey, voter_did, @@ -170,7 +170,7 @@ func (r *postgresVoteRepo) ListBySubject(ctx context.Context, subjectURI string, if err != nil { return nil, fmt.Errorf("failed to list votes by subject: %w", err) } - defer rows.Close() + defer func() { _ = rows.Close() }() var result []*votes.Vote for rows.Next() { @@ -211,7 +211,7 @@ func (r *postgresVoteRepo) ListByVoter(ctx context.Context, voterDID string, lim if err != nil { return nil, fmt.Errorf("failed to list votes by voter: %w", err) } - defer rows.Close() + defer func() { _ = rows.Close() }() var result []*votes.Vote for rows.Next() { diff --git a/internal/db/postgres/vote_repo_test.go b/internal/db/postgres/vote_repo_test.go index 63902bf..67dd2f3 100644 --- a/internal/db/postgres/vote_repo_test.go +++ b/internal/db/postgres/vote_repo_test.go @@ -52,7 +52,7 @@ func createTestUser(t *testing.T, db *sql.DB, handle, did string) { func TestVoteRepo_Create(t *testing.T) { db := setupTestDB(t) - defer db.Close() + defer func() { _ = db.Close() }() defer cleanupVotes(t, db) repo := NewVoteRepository(db) @@ -81,7 +81,7 @@ func TestVoteRepo_Create(t *testing.T) { func TestVoteRepo_Create_Idempotent(t *testing.T) { db := setupTestDB(t) - defer db.Close() + defer func() { _ = db.Close() }() defer cleanupVotes(t, db) repo := NewVoteRepository(db) @@ -123,7 +123,7 @@ func TestVoteRepo_Create_Idempotent(t *testing.T) { func TestVoteRepo_Create_VoterNotFound(t *testing.T) { db := setupTestDB(t) - defer db.Close() + defer func() { _ = db.Close() }() defer cleanupVotes(t, db) repo := NewVoteRepository(db) @@ -153,7 +153,7 @@ func TestVoteRepo_Create_VoterNotFound(t *testing.T) { func TestVoteRepo_GetByURI(t *testing.T) { db := setupTestDB(t) - defer db.Close() + defer func() { _ = db.Close() }() defer cleanupVotes(t, db) repo := NewVoteRepository(db) @@ -187,7 +187,7 @@ func TestVoteRepo_GetByURI(t *testing.T) { func TestVoteRepo_GetByURI_NotFound(t *testing.T) { db := setupTestDB(t) - defer db.Close() + defer func() { _ = db.Close() }() repo := NewVoteRepository(db) ctx := context.Background() @@ -198,7 +198,7 @@ func TestVoteRepo_GetByURI_NotFound(t *testing.T) { func TestVoteRepo_GetByVoterAndSubject(t *testing.T) { db := setupTestDB(t) - defer db.Close() + defer func() { _ = db.Close() }() defer cleanupVotes(t, db) repo := NewVoteRepository(db) @@ -233,7 +233,7 @@ func TestVoteRepo_GetByVoterAndSubject(t *testing.T) { func TestVoteRepo_GetByVoterAndSubject_NotFound(t *testing.T) { db := setupTestDB(t) - defer db.Close() + defer func() { _ = db.Close() }() repo := NewVoteRepository(db) ctx := context.Background() @@ -244,7 +244,7 @@ func TestVoteRepo_GetByVoterAndSubject_NotFound(t *testing.T) { func TestVoteRepo_Delete(t *testing.T) { db := setupTestDB(t) - defer db.Close() + defer func() { _ = db.Close() }() defer cleanupVotes(t, db) repo := NewVoteRepository(db) @@ -283,7 +283,7 @@ func TestVoteRepo_Delete(t *testing.T) { func TestVoteRepo_Delete_Idempotent(t *testing.T) { db := setupTestDB(t) - defer db.Close() + defer func() { _ = db.Close() }() defer cleanupVotes(t, db) repo := NewVoteRepository(db) @@ -316,7 +316,7 @@ func TestVoteRepo_Delete_Idempotent(t *testing.T) { func TestVoteRepo_ListBySubject(t *testing.T) { db := setupTestDB(t) - defer db.Close() + defer func() { _ = db.Close() }() defer cleanupVotes(t, db) repo := NewVoteRepository(db) @@ -362,7 +362,7 @@ func TestVoteRepo_ListBySubject(t *testing.T) { func TestVoteRepo_ListByVoter(t *testing.T) { db := setupTestDB(t) - defer db.Close() + defer func() { _ = db.Close() }() defer cleanupVotes(t, db) repo := NewVoteRepository(db) diff --git a/tests/integration/aggregator_e2e_test.go b/tests/integration/aggregator_e2e_test.go index 5eab32b..6a750e6 100644 --- a/tests/integration/aggregator_e2e_test.go +++ b/tests/integration/aggregator_e2e_test.go @@ -50,7 +50,7 @@ func TestAggregator_E2E_WithJetstream(t *testing.T) { t.Skipf("PDS not available at %s - run 'make dev-up' to start it", pdsURL) } if resp != nil { - resp.Body.Close() + _ = resp.Body.Close() } db := setupTestDB(t) defer func() { @@ -513,7 +513,7 @@ func TestAggregator_E2E_WithJetstream(t *testing.T) { // Views is []interface{}, unmarshal to check fields viewJSON, _ := json.Marshal(response.Views[0]) var view aggregator.AggregatorView - json.Unmarshal(viewJSON, &view) + _ = json.Unmarshal(viewJSON, &view) assert.Equal(t, aggregatorDID, view.DID) assert.Equal(t, "RSS Feed Aggregator", view.DisplayName) @@ -544,7 +544,7 @@ func TestAggregator_E2E_WithJetstream(t *testing.T) { viewJSON, _ := json.Marshal(response.Views[0]) var detailedView aggregator.AggregatorViewDetailed - json.Unmarshal(viewJSON, &detailedView) + _ = json.Unmarshal(viewJSON, &detailedView) assert.Equal(t, aggregatorDID, detailedView.DID) assert.Equal(t, 1, detailedView.Stats.CommunitiesUsing)