Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughModernized code to use Go 1.22+ idioms and helper utilities: replaced slice-producing splits with iterator-based splitters, switched Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
player/icy.go (1)
42-44: 🧹 Nitpick | 🔵 TrivialConsider using
min()for clamping, consistent with Go 1.21+ idioms.Since this PR modernizes the codebase for Go 1.26, the clamping logic could be simplified using the built-in
min()function introduced in Go 1.21.♻️ Proposed modernization
// Clamp the read so we never cross into a metadata block. - if len(p) > ir.remaining { - p = p[:ir.remaining] - } + p = p[:min(len(p), ir.remaining)] n, err := ir.r.Read(p)🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@player/icy.go` around lines 42 - 44, Replace the manual length-clamp using an if with Go's built-in min() to simplify and follow Go 1.21+ idioms: in the slice-read logic where p and ir.remaining are used (the snippet showing if len(p) > ir.remaining { p = p[:ir.remaining] }), compute the new length with min(len(p), ir.remaining) and reslice p accordingly (use the min result to set p = p[:min(...)]), keeping the same variable names and behavior.external/ytmusic/classify.go (1)
89-110: 🧹 Nitpick | 🔵 TrivialConsider modernizing to
wg.Go()for consistency.This goroutine still uses the manual
wg.Add(1)/defer wg.Done()pattern while similar code inprovider.go:fetchDurationswas modernized towg.Go(). With Go 1.22+ per-iteration loop variable scoping, you can capturepldirectly:♻️ Suggested refactor for consistency
for _, pl := range toClassify { - wg.Add(1) - go func(plID string) { - defer wg.Done() + wg.Go(func() { sem <- struct{}{} defer func() { <-sem }() resp, err := svc.PlaylistItems.List([]string{"contentDetails"}). - PlaylistId(plID). + PlaylistId(pl.ID). MaxResults(1). Context(ctx). Do() if err != nil || len(resp.Items) == 0 { - sampleCh <- sampleResult{playlistID: plID} + sampleCh <- sampleResult{playlistID: pl.ID} return } sampleCh <- sampleResult{ - playlistID: plID, + playlistID: pl.ID, videoID: resp.Items[0].ContentDetails.VideoId, } - }(pl.ID) + }) }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@external/ytmusic/classify.go` around lines 89 - 110, Replace the manual wg.Add(1)/defer wg.Done() goroutine pattern with wg.Go to match the style used elsewhere: capture the loop variable pl directly (don’t pass pl.ID into the closure), call wg.Go(func() error { ... return nil }) and move the semaphore operations, API call (svc.PlaylistItems.List...PlaylistId(pl.ID)...Do()), and sending to sampleCh/sampleResult inside that function; ensure errors still send a sampleResult{playlistID: pl.ID} before returning an error or nil, and remove the explicit wg.Add/Done calls.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@player/icy.go`:
- Around line 84-88: Remove the redundant alias variable `rest` introduced after
the strings.Cut call: delete the line `rest := after` and update subsequent
references of `rest` to use `after` directly (the variables returned from
strings.Cut in the same scope). This simplifies the logic in the parsing section
that currently uses `after`/`rest` without changing behavior.
---
Outside diff comments:
In `@external/ytmusic/classify.go`:
- Around line 89-110: Replace the manual wg.Add(1)/defer wg.Done() goroutine
pattern with wg.Go to match the style used elsewhere: capture the loop variable
pl directly (don’t pass pl.ID into the closure), call wg.Go(func() error { ...
return nil }) and move the semaphore operations, API call
(svc.PlaylistItems.List...PlaylistId(pl.ID)...Do()), and sending to
sampleCh/sampleResult inside that function; ensure errors still send a
sampleResult{playlistID: pl.ID} before returning an error or nil, and remove the
explicit wg.Add/Done calls.
In `@player/icy.go`:
- Around line 42-44: Replace the manual length-clamp using an if with Go's
built-in min() to simplify and follow Go 1.21+ idioms: in the slice-read logic
where p and ir.remaining are used (the snippet showing if len(p) > ir.remaining
{ p = p[:ir.remaining] }), compute the new length with min(len(p), ir.remaining)
and reslice p accordingly (use the min result to set p = p[:min(...)]), keeping
the same variable names and behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: fc5939d5-0b8b-4bb7-9d95-df66bcbd43e0
📒 Files selected for processing (41)
cmd/playlist.goexternal/local/provider.goexternal/navidrome/client.goexternal/radio/favorites.goexternal/radio/provider.goexternal/spotify/provider.goexternal/ytmusic/cache.goexternal/ytmusic/classify.goexternal/ytmusic/provider.goipc/protocol.goipc/protocol_test.goipc/server.goipc/server_test.goluaplugin/api_control.goluaplugin/api_log.goluaplugin/hooks.goluaplugin/luaplugin.goluaplugin/luaplugin_test.golyrics/lyrics.gomain.goplayer/chained_ogg.goplayer/icy.goplayer/player.goplayer/speed.goplayer/tap.goplaylist/playlist_test.goplaylist/shuffle_repeat_test.goresolve/m3u.goui/model/filebrowser.goui/model/keys.goui/model/keys_nav.goui/model/speed_controls_test.goui/model/tick.goui/model/view.goui/model/view_helpers.goui/model/view_nav.goui/model/view_overlays.goui/model/view_state_test.goui/vis_butterfly.goui/vis_classic_peak_test.goui/vis_retro.go
💤 Files with no reviewable changes (2)
- luaplugin/api_log.go
- luaplugin/hooks.go
This is pretty straight-forward: https://go.dev/blog/gofix
Summary by CodeRabbit