chore(lint): clear pre-existing CI lint debt

Nine golangci-lint failures accumulated across M7 #352, #372, and
6d1709c that were never surfaced because test-go never ran green long
enough to reach the lint step. The first push to land cleanly through
vet (the M7 #363 slice) ran lint and exposed them.

- errcheck: discard the error on defer Close() in collage.go,
  collage_test.go, and server_test.go.
- gofmt -s: re-run on config.go and playlists_test.go.
- goimports: move the stray "time" import from the local-module group
  to stdlib in server_test.go.
- revive unused-parameter: rename ctx to _ on stubScanner.Scan and
  fakeLidarrUnmonitorer.UnmonitorTrack (test stubs); on
  tracks.Service's adminID, add //nolint:revive directive rather than
  renaming because the HTTP handler passes admin.ID (a real authed-user
  UUID) and the existing comment already flags it as reserved for the
  audit-log follow-up.
This commit is contained in:
2026-05-03 18:59:58 -04:00
parent 66f651cf5c
commit a8fd33d4ed
7 changed files with 8 additions and 8 deletions
-1
View File
@@ -454,4 +454,3 @@ func TestPlaylists_CoverNoneReturns404(t *testing.T) {
t.Errorf("status = %d, want 404; body = %s", w.Code, w.Body.String())
}
}
+1
View File
@@ -29,6 +29,7 @@ type ServerConfig struct {
// StorageConfig points at on-disk locations the server uses for cached
// runtime artifacts. Currently:
// - DataDir hosts <DataDir>/playlist_covers/{playlist_id}.jpg (M7 #352).
//
// More entries may grow here (e.g., transcode cache) without breaking
// existing layouts.
type StorageConfig struct {
+1 -1
View File
@@ -116,7 +116,7 @@ func loadCellImage(coverPath, dataDir string) image.Image {
if err != nil {
return fallbackGlyph()
}
defer f.Close()
defer func() { _ = f.Close() }()
img, _, err := image.Decode(f)
if err != nil {
return fallbackGlyph()
+1 -1
View File
@@ -61,7 +61,7 @@ func TestGenerateCollage_OneTrack(t *testing.T) {
if err != nil {
t.Fatalf("open collage: %v", err)
}
defer f.Close()
defer func() { _ = f.Close() }()
img, format, err := image.Decode(f)
if err != nil {
t.Fatalf("decode collage: %v", err)
+3 -3
View File
@@ -10,6 +10,7 @@ import (
"os"
"strings"
"testing"
"time"
"github.com/go-chi/chi/v5"
"github.com/jackc/pgx/v5/pgxpool"
@@ -20,7 +21,6 @@ import (
"git.fabledsword.com/bvandeusen/minstrel/internal/db/dbq"
"git.fabledsword.com/bvandeusen/minstrel/internal/library"
"git.fabledsword.com/bvandeusen/minstrel/internal/subsonic"
"time"
)
func TestHealthz(t *testing.T) {
@@ -58,7 +58,7 @@ func TestHealthz_IncludesMinClientVersion(t *testing.T) {
if err != nil {
t.Fatalf("GET /healthz: %v", err)
}
defer resp.Body.Close()
defer func() { _ = resp.Body.Close() }()
var body map[string]string
if err := json.NewDecoder(resp.Body).Decode(&body); err != nil {
@@ -247,6 +247,6 @@ func TestRouter_AdminSubtreeNotShadowed(t *testing.T) {
// route-presence assertions in this file.
type stubScanner struct{}
func (stubScanner) Scan(ctx context.Context) (library.Stats, error) {
func (stubScanner) Scan(_ context.Context) (library.Stats, error) {
panic("stubScanner.Scan called from server_test")
}
+1 -1
View File
@@ -84,7 +84,7 @@ func NewService(pool *pgxpool.Pool, logger *slog.Logger, lidarr LidarrUnmonitore
// re-plumb when audit logging lands.
func (s *Service) RemoveTrack(
ctx context.Context,
trackID, adminID pgtype.UUID,
trackID, adminID pgtype.UUID, //nolint:revive // adminID reserved for audit-log wiring in a follow-up
unmonitor bool,
) (deletedAlbumID *pgtype.UUID, deletedArtistID *pgtype.UUID, lidarrUnmonitorFailed bool, err error) {
q := dbq.New(s.pool)
+1 -1
View File
@@ -106,7 +106,7 @@ type fakeLidarrUnmonitorer struct {
err error
}
func (f *fakeLidarrUnmonitorer) UnmonitorTrack(ctx context.Context, trackMbid, albumMbid string) error {
func (f *fakeLidarrUnmonitorer) UnmonitorTrack(_ context.Context, trackMbid, albumMbid string) error {
f.calls = append(f.calls, trackMbid)
f.albumMbid = albumMbid
return f.err