From 8d5c90e0eda6de5c3ba38eb46aac00a0e4ba4e6d Mon Sep 17 00:00:00 2001 From: Bryan Van Deusen Date: Sat, 9 May 2026 22:47:25 -0400 Subject: [PATCH] fix(server): wrap defer tx.Rollback for errcheck + gofmt -s alignment golangci-lint surfaced both on 9c7dec6: - errcheck on bare 'defer tx.Rollback(ctx)' in 2 test files - gofmt -s wanted tighter map-key alignment in library_sync.go + library_sync_test.go (auto-fixed by 'gofmt -s -w') Co-Authored-By: Claude Opus 4.7 (1M context) --- internal/api/library_sync.go | 4 ++-- internal/api/library_sync_test.go | 3 +-- internal/sync/changes_test.go | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/internal/api/library_sync.go b/internal/api/library_sync.go index 6bebad3b..5bf42489 100644 --- a/internal/api/library_sync.go +++ b/internal/api/library_sync.go @@ -227,8 +227,8 @@ func scopedLikeRows(rows []string, userIDStr, entityKey string) []json.RawMessag continue } b, _ := json.Marshal(map[string]string{ - "user_id": parts[0], - entityKey: parts[1], + "user_id": parts[0], + entityKey: parts[1], }) msgs = append(msgs, b) } diff --git a/internal/api/library_sync_test.go b/internal/api/library_sync_test.go index 1ff280b3..6ffc795c 100644 --- a/internal/api/library_sync_test.go +++ b/internal/api/library_sync_test.go @@ -49,7 +49,7 @@ func TestLibrarySync_AfterArtistUpsert_ReturnsHydratedPayload(t *testing.T) { if err != nil { t.Fatalf("begin: %v", err) } - defer tx.Rollback(ctx) + defer func() { _ = tx.Rollback(ctx) }() var artistID string if err := tx.QueryRow(ctx, `INSERT INTO artists (name, sort_name) VALUES ($1, $2) RETURNING id::text`, @@ -205,4 +205,3 @@ func TestSplitOnce(t *testing.T) { } } } - diff --git a/internal/sync/changes_test.go b/internal/sync/changes_test.go index 1da49dc9..fc674acd 100644 --- a/internal/sync/changes_test.go +++ b/internal/sync/changes_test.go @@ -43,7 +43,7 @@ func TestLogChange_WritesRowInTx(t *testing.T) { tx, err := pool.Begin(ctx) require.NoError(t, err) - defer tx.Rollback(ctx) + defer func() { _ = tx.Rollback(ctx) }() require.NoError(t, sync.LogChange(ctx, tx, sync.EntityArtist, "artist-123", sync.OpUpsert)) require.NoError(t, tx.Commit(ctx))