Fix all staticcheck errors that are not deprecations
This commit is contained in:
@@ -58,9 +58,7 @@ func init() {
|
||||
return err
|
||||
})
|
||||
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 = s[:len(s)-1]
|
||||
}
|
||||
s = strings.TrimSuffix(s, "%")
|
||||
v, err := strconv.ParseFloat(s, 64)
|
||||
VolumePctCLIArg = v
|
||||
return err
|
||||
|
||||
@@ -22,11 +22,8 @@ func (s *subsonicMediaProvider) ArtistSortOrders() []string {
|
||||
}
|
||||
}
|
||||
|
||||
func filterArtistMatches(f mediaprovider.ArtistFilter, artist *subsonic.ArtistID3) bool {
|
||||
if artist == nil {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
func filterArtistMatches(_ mediaprovider.ArtistFilter, artist *subsonic.ArtistID3) bool {
|
||||
return artist != nil
|
||||
}
|
||||
|
||||
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
|
||||
for _, idx := range idxs.Index {
|
||||
for _, ar := range idx.Artist {
|
||||
artists = append(artists, ar)
|
||||
}
|
||||
artists = append(artists, idx.Artist...)
|
||||
}
|
||||
artists = sortFn(artists)
|
||||
return artists, nil
|
||||
|
||||
@@ -24,18 +24,18 @@ const (
|
||||
|
||||
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) {
|
||||
return nil, smtcUnsupportedErr
|
||||
return nil, errSMTCUnsupported
|
||||
}
|
||||
|
||||
func (s *SMTC) SetEnabled(enabled bool) error {
|
||||
return smtcUnsupportedErr
|
||||
return errSMTCUnsupported
|
||||
}
|
||||
|
||||
func (s *SMTC) SetThumbnail(filepath string) error {
|
||||
return smtcUnsupportedErr
|
||||
return errSMTCUnsupported
|
||||
}
|
||||
|
||||
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) UpdatePlaybackState(state SMTCPlaybackState) error {
|
||||
return smtcUnsupportedErr
|
||||
return errSMTCUnsupported
|
||||
}
|
||||
|
||||
func (s *SMTC) UpdateMetadata(title, artist string) error {
|
||||
return smtcUnsupportedErr
|
||||
return errSMTCUnsupported
|
||||
}
|
||||
|
||||
func (s *SMTC) UpdatePosition(positionMillis, durationMillis int) error {
|
||||
return smtcUnsupportedErr
|
||||
return errSMTCUnsupported
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package controller
|
||||
|
||||
import (
|
||||
"archive/zip"
|
||||
"errors"
|
||||
"fmt"
|
||||
"image"
|
||||
"image/color"
|
||||
@@ -546,7 +547,7 @@ func (c *Controller) sendNotification(title, content string) {
|
||||
|
||||
func (c *Controller) showError(content string) {
|
||||
// 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) {
|
||||
|
||||
@@ -378,11 +378,10 @@ func setPlayBtnTranslucency(f float32) {
|
||||
|
||||
// get theme Primary color as color.NRGBA
|
||||
var primary color.NRGBA
|
||||
switch pr := theme.Color(theme.ColorNamePrimary); pr.(type) {
|
||||
switch pr := theme.Color(theme.ColorNamePrimary).(type) {
|
||||
case color.NRGBA:
|
||||
primary = pr.(color.NRGBA)
|
||||
primary = pr
|
||||
case color.RGBA:
|
||||
pr := pr.(color.RGBA)
|
||||
primary = color.NRGBA{R: pr.R, G: pr.G, B: pr.B, A: pr.A}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user