fix(go): collapse struct-literal copies to type conversions (S1016)
staticcheck S1016 in the new golangci-lint v2 flagged four sites
copying field-by-field between two types with identical struct
shapes. Direct type conversion is the canonical form:
- internal/library/scanrun.go:
- LibraryStageTallies copy from Stats → LibraryStageTallies(lastStats)
- MBIDBackfillStageTallies copy from BackfillMBIDsResult →
MBIDBackfillStageTallies(lastRes)
- internal/recommendation/home.go:
- dbq.ListRediscoverAlbumsForUserRow copy from the Fallback row
type → dbq.ListRediscoverAlbumsForUserRow(r)
- Same pattern for the Artists rediscover pair.
No behavior change; the underlying struct shapes are identical
(staticcheck verified the conversion is valid). Net -18 +4 lines.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -145,10 +145,7 @@ func loadRediscoverAlbums(ctx context.Context, q *dbq.Queries, userID pgtype.UUI
|
||||
if _, dup := seen[r.Album.ID]; dup {
|
||||
continue
|
||||
}
|
||||
primary = append(primary, dbq.ListRediscoverAlbumsForUserRow{
|
||||
Album: r.Album,
|
||||
ArtistName: r.ArtistName,
|
||||
})
|
||||
primary = append(primary, dbq.ListRediscoverAlbumsForUserRow(r))
|
||||
if len(primary) >= HomeRediscoverLimit {
|
||||
break
|
||||
}
|
||||
@@ -181,11 +178,7 @@ func loadRediscoverArtists(ctx context.Context, q *dbq.Queries, userID pgtype.UU
|
||||
if _, dup := seen[r.Artist.ID]; dup {
|
||||
continue
|
||||
}
|
||||
primary = append(primary, dbq.ListRediscoverArtistsForUserRow{
|
||||
Artist: r.Artist,
|
||||
CoverAlbumID: r.CoverAlbumID,
|
||||
AlbumCount: r.AlbumCount,
|
||||
})
|
||||
primary = append(primary, dbq.ListRediscoverArtistsForUserRow(r))
|
||||
if len(primary) >= HomeRediscoverLimit {
|
||||
break
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user