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:
@@ -100,11 +100,7 @@ func RunScan(
|
||||
var lastStats Stats
|
||||
libPub := newStagePublisher(ctx, 500, time.Second,
|
||||
func() []byte {
|
||||
blob, _ := json.Marshal(LibraryStageTallies{
|
||||
Scanned: lastStats.Scanned, Added: lastStats.Added,
|
||||
Updated: lastStats.Updated, Skipped: lastStats.Skipped,
|
||||
Errored: lastStats.Errored,
|
||||
})
|
||||
blob, _ := json.Marshal(LibraryStageTallies(lastStats))
|
||||
return blob
|
||||
},
|
||||
func(blob []byte) error {
|
||||
@@ -131,10 +127,7 @@ func RunScan(
|
||||
var lastRes BackfillMBIDsResult
|
||||
bfPub := newStagePublisher(ctx, 500, time.Second,
|
||||
func() []byte {
|
||||
blob, _ := json.Marshal(MBIDBackfillStageTallies{
|
||||
Processed: lastRes.Processed, Healed: lastRes.Healed,
|
||||
Skipped: lastRes.Skipped, Duplicates: lastRes.Duplicates,
|
||||
})
|
||||
blob, _ := json.Marshal(MBIDBackfillStageTallies(lastRes))
|
||||
return blob
|
||||
},
|
||||
func(blob []byte) error {
|
||||
|
||||
Reference in New Issue
Block a user