🎧 Your Personal Streaming Service
Go airsonicmadsonicmedia-servermusicmusic-servernavidromeopensubsonicraspberry-piself-hostedstreamerstreaming-apistreaming-audiosubsonicsubsonic-server
Fix small lint errors found by gocritic
Deluanb0fc684cb612
diff --git a/.golangci.yml b/.golangci.ymlindex dcaeaaf65..e8e1e7e26 100644--- a/.golangci.yml+++ b/.golangci.yml@@ -2,10 +2,10 @@ linters:enable:- bodyclose- deadcode+ - depguard- dogsled- errcheck- gocyclo- - goimports- goprintffuncname- gosec- gosimplediff --git a/core/agents/agents.go b/core/agents/agents.goindex bda62ade0..e9e384e59 100644--- a/core/agents/agents.go+++ b/core/agents/agents.go@@ -106,7 +106,7 @@ func (a *Agents) GetSimilar(ctx context.Context, id, name, mbid string, limit incontinue}similar, err := agent.GetSimilar(ctx, id, name, mbid, limit)- if len(similar) >= 0 && err == nil {+ if len(similar) > 0 && err == nil {log.Debug(ctx, "Got Similar Artists", "agent", ag.AgentName(), "artist", name, "similar", similar, "elapsed", time.Since(start))return similar, err}diff --git a/core/scrobbler/buffered_scrobbler.go b/core/scrobbler/buffered_scrobbler.goindex 1d98293e4..0064d5bdd 100644--- a/core/scrobbler/buffered_scrobbler.go+++ b/core/scrobbler/buffered_scrobbler.go@@ -8,7 +8,7 @@ import ("github.com/navidrome/navidrome/model")-func NewBufferedScrobbler(ds model.DataStore, s Scrobbler, service string) *bufferedScrobbler {+func newBufferedScrobbler(ds model.DataStore, s Scrobbler, service string) *bufferedScrobbler {b := &bufferedScrobbler{ds: ds, wrapped: s, service: service}b.wakeSignal = make(chan struct{}, 1)go b.run()diff --git a/core/scrobbler/play_tracker.go b/core/scrobbler/play_tracker.goindex 354b28d03..f83ac7257 100644--- a/core/scrobbler/play_tracker.go+++ b/core/scrobbler/play_tracker.go@@ -53,7 +53,7 @@ func GetPlayTracker(ds model.DataStore, broker events.Broker) PlayTracker {for name, constructor := range constructors {s := constructor(ds)if conf.Server.DevEnableBufferedScrobble {- s = NewBufferedScrobbler(ds, s, name)+ s = newBufferedScrobbler(ds, s, name)}p.scrobblers[name] = s}diff --git a/core/transcoder/ffmpeg.go b/core/transcoder/ffmpeg.goindex a654ae583..b3ff0aad9 100644--- a/core/transcoder/ffmpeg.go+++ b/core/transcoder/ffmpeg.go@@ -47,8 +47,8 @@ func (ff *ffmpeg) Start(ctx context.Context, command, path string, maxBitRate infunc createTranscodeCommand(cmd, path string, maxBitRate int) []string {split := strings.Split(cmd, " ")for i, s := range split {- s = strings.Replace(s, "%s", path, -1)- s = strings.Replace(s, "%b", strconv.Itoa(maxBitRate), -1)+ s = strings.ReplaceAll(s, "%s", path)+ s = strings.ReplaceAll(s, "%b", strconv.Itoa(maxBitRate))split[i] = s}diff --git a/persistence/mediafile_repository.go b/persistence/mediafile_repository.goindex 1d5b03163..5b22589e2 100644--- a/persistence/mediafile_repository.go+++ b/persistence/mediafile_repository.go@@ -98,7 +98,7 @@ func (r mediaFileRepository) FindByPath(path string) (*model.MediaFile, error) {func cleanPath(path string) string {path = filepath.Clean(path)if !strings.HasSuffix(path, string(os.PathSeparator)) {- path = path + string(os.PathSeparator)+ path += string(os.PathSeparator)}return path}diff --git a/utils/index_group_parser.go b/utils/index_group_parser.goindex 2ca2f2796..2257f6070 100644--- a/utils/index_group_parser.go+++ b/utils/index_group_parser.go@@ -25,7 +25,7 @@ func ParseIndexGroups(spec string) IndexGroups {sub := re.FindStringSubmatch(g)if len(sub) > 0 {i := 0- chars := strings.SplitN(sub[2], "", -1)+ chars := strings.Split(sub[2], "")for _, c := range chars {parsed[c] = sub[1]i++