Fix all staticcheck errors that are not deprecations

This commit is contained in:
Jacalz
2025-09-17 22:39:36 +02:00
parent 08f335da44
commit ebc5b7e039
5 changed files with 15 additions and 22 deletions
+1 -3
View File
@@ -58,9 +58,7 @@ func init() {
return err return err
}) })
flag.Func("volume-adjust-pct", "adjusts volume up or down by the given percentage (positive or negative)", func(s string) error { flag.Func("volume-adjust-pct", "adjusts volume up or down by the given percentage (positive or negative)", func(s string) error {
if strings.HasSuffix(s, "%") { s = strings.TrimSuffix(s, "%")
s = s[:len(s)-1]
}
v, err := strconv.ParseFloat(s, 64) v, err := strconv.ParseFloat(s, 64)
VolumePctCLIArg = v VolumePctCLIArg = v
return err return err
@@ -22,11 +22,8 @@ func (s *subsonicMediaProvider) ArtistSortOrders() []string {
} }
} }
func filterArtistMatches(f mediaprovider.ArtistFilter, artist *subsonic.ArtistID3) bool { func filterArtistMatches(_ mediaprovider.ArtistFilter, artist *subsonic.ArtistID3) bool {
if artist == nil { return artist != nil
return false
}
return true
} }
func (s *subsonicMediaProvider) IterateArtists(sortOrder string, filter mediaprovider.ArtistFilter) mediaprovider.ArtistIterator { func (s *subsonicMediaProvider) IterateArtists(sortOrder string, filter mediaprovider.ArtistFilter) mediaprovider.ArtistIterator {
@@ -176,9 +173,7 @@ func (s *subsonicMediaProvider) artistFetchFnFromStandardSort(sortFn func([]*sub
} }
var artists []*subsonic.ArtistID3 var artists []*subsonic.ArtistID3
for _, idx := range idxs.Index { for _, idx := range idxs.Index {
for _, ar := range idx.Artist { artists = append(artists, idx.Artist...)
artists = append(artists, ar)
}
} }
artists = sortFn(artists) artists = sortFn(artists)
return artists, nil return artists, nil
+7 -7
View File
@@ -24,18 +24,18 @@ const (
type SMTC struct{} type SMTC struct{}
var smtcUnsupportedErr = errors.New("SMTC is not supported on this platformo") var errSMTCUnsupported = errors.New("no support for SMTC on this platform")
func InitSMTCForWindow(hwnd uintptr) (*SMTC, error) { func InitSMTCForWindow(hwnd uintptr) (*SMTC, error) {
return nil, smtcUnsupportedErr return nil, errSMTCUnsupported
} }
func (s *SMTC) SetEnabled(enabled bool) error { func (s *SMTC) SetEnabled(enabled bool) error {
return smtcUnsupportedErr return errSMTCUnsupported
} }
func (s *SMTC) SetThumbnail(filepath string) error { func (s *SMTC) SetThumbnail(filepath string) error {
return smtcUnsupportedErr return errSMTCUnsupported
} }
func (s *SMTC) OnButtonPressed(func(SMTCButton)) {} func (s *SMTC) OnButtonPressed(func(SMTCButton)) {}
@@ -45,13 +45,13 @@ func (s *SMTC) OnSeek(f func(millis int)) {}
func (s *SMTC) Shutdown() {} func (s *SMTC) Shutdown() {}
func (s *SMTC) UpdatePlaybackState(state SMTCPlaybackState) error { func (s *SMTC) UpdatePlaybackState(state SMTCPlaybackState) error {
return smtcUnsupportedErr return errSMTCUnsupported
} }
func (s *SMTC) UpdateMetadata(title, artist string) error { func (s *SMTC) UpdateMetadata(title, artist string) error {
return smtcUnsupportedErr return errSMTCUnsupported
} }
func (s *SMTC) UpdatePosition(positionMillis, durationMillis int) error { func (s *SMTC) UpdatePosition(positionMillis, durationMillis int) error {
return smtcUnsupportedErr return errSMTCUnsupported
} }
+2 -1
View File
@@ -2,6 +2,7 @@ package controller
import ( import (
"archive/zip" "archive/zip"
"errors"
"fmt" "fmt"
"image" "image"
"image/color" "image/color"
@@ -546,7 +547,7 @@ func (c *Controller) sendNotification(title, content string) {
func (c *Controller) showError(content string) { func (c *Controller) showError(content string) {
// TODO: display an in-app toast message instead of a dialog. // TODO: display an in-app toast message instead of a dialog.
dialog.ShowError(fmt.Errorf(content), c.MainWindow) dialog.ShowError(errors.New(content), c.MainWindow)
} }
func (c *Controller) ShowAlbumInfoDialog(albumID, albumName string, albumCover image.Image) { func (c *Controller) ShowAlbumInfoDialog(albumID, albumName string, albumCover image.Image) {
+2 -3
View File
@@ -378,11 +378,10 @@ func setPlayBtnTranslucency(f float32) {
// get theme Primary color as color.NRGBA // get theme Primary color as color.NRGBA
var primary color.NRGBA var primary color.NRGBA
switch pr := theme.Color(theme.ColorNamePrimary); pr.(type) { switch pr := theme.Color(theme.ColorNamePrimary).(type) {
case color.NRGBA: case color.NRGBA:
primary = pr.(color.NRGBA) primary = pr
case color.RGBA: case color.RGBA:
pr := pr.(color.RGBA)
primary = color.NRGBA{R: pr.R, G: pr.G, B: pr.B, A: pr.A} primary = color.NRGBA{R: pr.R, G: pr.G, B: pr.B, A: pr.A}
} }