mirror of
https://github.com/navidrome/navidrome.git
synced 2025-04-01 19:47:37 +03:00
Add nilerr linter
This commit is contained in:
parent
364e699ac1
commit
f82df70302
7 changed files with 11 additions and 10 deletions
|
@ -20,6 +20,7 @@ linters:
|
|||
- govet
|
||||
- ineffassign
|
||||
- misspell
|
||||
- nilerr
|
||||
- rowserrcheck
|
||||
- staticcheck
|
||||
- typecheck
|
||||
|
|
|
@ -54,7 +54,7 @@ func (a *Agents) GetMBID(ctx context.Context, id string, name string) (string, e
|
|||
mbid, err := agent.GetMBID(ctx, id, name)
|
||||
if mbid != "" && err == nil {
|
||||
log.Debug(ctx, "Got MBID", "agent", ag.AgentName(), "artist", name, "mbid", mbid, "elapsed", time.Since(start))
|
||||
return mbid, err
|
||||
return mbid, nil
|
||||
}
|
||||
}
|
||||
return "", ErrNotFound
|
||||
|
@ -73,7 +73,7 @@ func (a *Agents) GetURL(ctx context.Context, id, name, mbid string) (string, err
|
|||
url, err := agent.GetURL(ctx, id, name, mbid)
|
||||
if url != "" && err == nil {
|
||||
log.Debug(ctx, "Got External Url", "agent", ag.AgentName(), "artist", name, "url", url, "elapsed", time.Since(start))
|
||||
return url, err
|
||||
return url, nil
|
||||
}
|
||||
}
|
||||
return "", ErrNotFound
|
||||
|
@ -92,7 +92,7 @@ func (a *Agents) GetBiography(ctx context.Context, id, name, mbid string) (strin
|
|||
bio, err := agent.GetBiography(ctx, id, name, mbid)
|
||||
if bio != "" && err == nil {
|
||||
log.Debug(ctx, "Got Biography", "agent", ag.AgentName(), "artist", name, "len", len(bio), "elapsed", time.Since(start))
|
||||
return bio, err
|
||||
return bio, nil
|
||||
}
|
||||
}
|
||||
return "", ErrNotFound
|
||||
|
@ -134,7 +134,7 @@ func (a *Agents) GetImages(ctx context.Context, id, name, mbid string) ([]Artist
|
|||
images, err := agent.GetImages(ctx, id, name, mbid)
|
||||
if len(images) > 0 && err == nil {
|
||||
log.Debug(ctx, "Got Images", "agent", ag.AgentName(), "artist", name, "images", images, "elapsed", time.Since(start))
|
||||
return images, err
|
||||
return images, nil
|
||||
}
|
||||
}
|
||||
return nil, ErrNotFound
|
||||
|
@ -153,7 +153,7 @@ func (a *Agents) GetTopSongs(ctx context.Context, id, artistName, mbid string, c
|
|||
songs, err := agent.GetTopSongs(ctx, id, artistName, mbid, count)
|
||||
if len(songs) > 0 && err == nil {
|
||||
log.Debug(ctx, "Got Top Songs", "agent", ag.AgentName(), "artist", artistName, "songs", songs, "elapsed", time.Since(start))
|
||||
return songs, err
|
||||
return songs, nil
|
||||
}
|
||||
}
|
||||
return nil, ErrNotFound
|
||||
|
|
|
@ -25,7 +25,7 @@ func (r propertyRepository) Put(id string, value string) error {
|
|||
update := Update(r.tableName).Set("value", value).Where(Eq{"id": id})
|
||||
count, err := r.executeSQL(update)
|
||||
if err != nil {
|
||||
return nil
|
||||
return err
|
||||
}
|
||||
if count > 0 {
|
||||
return nil
|
||||
|
|
|
@ -25,7 +25,7 @@ func (r userPropsRepository) Put(userId, key string, value string) error {
|
|||
update := Update(r.tableName).Set("value", value).Where(And{Eq{"user_id": userId}, Eq{"key": key}})
|
||||
count, err := r.executeSQL(update)
|
||||
if err != nil {
|
||||
return nil
|
||||
return err
|
||||
}
|
||||
if count > 0 {
|
||||
return nil
|
||||
|
|
|
@ -53,7 +53,7 @@ func (p *MockedPropertyRepo) DefaultGet(id string, defaultValue string) (string,
|
|||
p.init()
|
||||
v, err := p.Get(id)
|
||||
if err != nil {
|
||||
return defaultValue, nil
|
||||
return defaultValue, nil //nolint:nilerr
|
||||
}
|
||||
return v, nil
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ func (p *MockedUserPropsRepo) DefaultGet(userId, key string, defaultValue string
|
|||
p.init()
|
||||
v, err := p.Get(userId, key)
|
||||
if err != nil {
|
||||
return defaultValue, nil
|
||||
return defaultValue, nil //nolint:nilerr
|
||||
}
|
||||
return v, nil
|
||||
}
|
||||
|
|
2
utils/cache/spread_fs.go
vendored
2
utils/cache/spread_fs.go
vendored
|
@ -47,7 +47,7 @@ func (sfs *spreadFS) Reload(f func(key string, name string)) error {
|
|||
}
|
||||
path, err := filepath.Rel(sfs.root, absoluteFilePath)
|
||||
if err != nil {
|
||||
return nil
|
||||
return nil //nolint:nilerr
|
||||
}
|
||||
|
||||
// Skip if name is not in the format XX/XX/XXXXXXXXXXXX
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue