Fix small lint errors found by gocritic
This commit is contained in:
+1
-1
@@ -2,10 +2,10 @@ linters:
|
|||||||
enable:
|
enable:
|
||||||
- bodyclose
|
- bodyclose
|
||||||
- deadcode
|
- deadcode
|
||||||
|
- depguard
|
||||||
- dogsled
|
- dogsled
|
||||||
- errcheck
|
- errcheck
|
||||||
- gocyclo
|
- gocyclo
|
||||||
- goimports
|
|
||||||
- goprintffuncname
|
- goprintffuncname
|
||||||
- gosec
|
- gosec
|
||||||
- gosimple
|
- gosimple
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ func (a *Agents) GetSimilar(ctx context.Context, id, name, mbid string, limit in
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
similar, err := agent.GetSimilar(ctx, id, name, mbid, limit)
|
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))
|
log.Debug(ctx, "Got Similar Artists", "agent", ag.AgentName(), "artist", name, "similar", similar, "elapsed", time.Since(start))
|
||||||
return similar, err
|
return similar, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import (
|
|||||||
"github.com/navidrome/navidrome/model"
|
"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 := &bufferedScrobbler{ds: ds, wrapped: s, service: service}
|
||||||
b.wakeSignal = make(chan struct{}, 1)
|
b.wakeSignal = make(chan struct{}, 1)
|
||||||
go b.run()
|
go b.run()
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ func GetPlayTracker(ds model.DataStore, broker events.Broker) PlayTracker {
|
|||||||
for name, constructor := range constructors {
|
for name, constructor := range constructors {
|
||||||
s := constructor(ds)
|
s := constructor(ds)
|
||||||
if conf.Server.DevEnableBufferedScrobble {
|
if conf.Server.DevEnableBufferedScrobble {
|
||||||
s = NewBufferedScrobbler(ds, s, name)
|
s = newBufferedScrobbler(ds, s, name)
|
||||||
}
|
}
|
||||||
p.scrobblers[name] = s
|
p.scrobblers[name] = s
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,8 +47,8 @@ func (ff *ffmpeg) Start(ctx context.Context, command, path string, maxBitRate in
|
|||||||
func createTranscodeCommand(cmd, path string, maxBitRate int) []string {
|
func createTranscodeCommand(cmd, path string, maxBitRate int) []string {
|
||||||
split := strings.Split(cmd, " ")
|
split := strings.Split(cmd, " ")
|
||||||
for i, s := range split {
|
for i, s := range split {
|
||||||
s = strings.Replace(s, "%s", path, -1)
|
s = strings.ReplaceAll(s, "%s", path)
|
||||||
s = strings.Replace(s, "%b", strconv.Itoa(maxBitRate), -1)
|
s = strings.ReplaceAll(s, "%b", strconv.Itoa(maxBitRate))
|
||||||
split[i] = s
|
split[i] = s
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ func (r mediaFileRepository) FindByPath(path string) (*model.MediaFile, error) {
|
|||||||
func cleanPath(path string) string {
|
func cleanPath(path string) string {
|
||||||
path = filepath.Clean(path)
|
path = filepath.Clean(path)
|
||||||
if !strings.HasSuffix(path, string(os.PathSeparator)) {
|
if !strings.HasSuffix(path, string(os.PathSeparator)) {
|
||||||
path = path + string(os.PathSeparator)
|
path += string(os.PathSeparator)
|
||||||
}
|
}
|
||||||
return path
|
return path
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ func ParseIndexGroups(spec string) IndexGroups {
|
|||||||
sub := re.FindStringSubmatch(g)
|
sub := re.FindStringSubmatch(g)
|
||||||
if len(sub) > 0 {
|
if len(sub) > 0 {
|
||||||
i := 0
|
i := 0
|
||||||
chars := strings.SplitN(sub[2], "", -1)
|
chars := strings.Split(sub[2], "")
|
||||||
for _, c := range chars {
|
for _, c := range chars {
|
||||||
parsed[c] = sub[1]
|
parsed[c] = sub[1]
|
||||||
i++
|
i++
|
||||||
|
|||||||
Reference in New Issue
Block a user