Skip to content

Commit

Permalink
Fix small lint errors found by gocritic
Browse files Browse the repository at this point in the history
  • Loading branch information
deluan committed Jul 15, 2021
1 parent 8d56ec8 commit b0fc684
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ linters:
enable:
- bodyclose
- deadcode
- depguard
- dogsled
- errcheck
- gocyclo
- goimports
- goprintffuncname
- gosec
- gosimple
Expand Down
2 changes: 1 addition & 1 deletion core/agents/agents.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ func (a *Agents) GetSimilar(ctx context.Context, id, name, mbid string, limit in
continue
}
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
}
Expand Down
2 changes: 1 addition & 1 deletion core/scrobbler/buffered_scrobbler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion core/scrobbler/play_tracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
4 changes: 2 additions & 2 deletions core/transcoder/ffmpeg.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ func (ff *ffmpeg) Start(ctx context.Context, command, path string, maxBitRate in
func 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
}

Expand Down
2 changes: 1 addition & 1 deletion persistence/mediafile_repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion utils/index_group_parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -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++
Expand Down

0 comments on commit b0fc684

Please sign in to comment.