🎧 Your Personal Streaming Service
Go airsonicmadsonicmedia-servermusicmusic-servernavidromeopensubsonicraspberry-piself-hostedstreamerstreaming-apistreaming-audiosubsonicsubsonic-server
Add nilerr linter
Deluanf82df703022f
diff --git a/.golangci.yml b/.golangci.ymlindex 804b5995b..ecb633422 100644--- a/.golangci.yml+++ b/.golangci.yml@@ -20,6 +20,7 @@ linters:- govet- ineffassign- misspell+ - nilerr- rowserrcheck- staticcheck- typecheckdiff --git a/core/agents/agents.go b/core/agents/agents.goindex edf168e68..4f50b5f0a 100644--- a/core/agents/agents.go+++ b/core/agents/agents.go@@ -54,7 +54,7 @@ func (a *Agents) GetMBID(ctx context.Context, id string, name string) (string, embid, 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, errurl, 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) (strinbio, 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) ([]Artistimages, 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, csongs, 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, ErrNotFounddiff --git a/persistence/property_repository.go b/persistence/property_repository.goindex ece50305e..d62cdec6e 100644--- a/persistence/property_repository.go+++ b/persistence/property_repository.go@@ -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 nildiff --git a/persistence/user_props_repository.go b/persistence/user_props_repository.goindex 90a75bf8a..1fe9c7b92 100644--- a/persistence/user_props_repository.go+++ b/persistence/user_props_repository.go@@ -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 nildiff --git a/tests/mock_property_repo.go b/tests/mock_property_repo.goindex be88efc1c..39dec17b3 100644--- a/tests/mock_property_repo.go+++ b/tests/mock_property_repo.go@@ -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}diff --git a/tests/mock_user_props_repo.go b/tests/mock_user_props_repo.goindex 2f8554d70..b1880c999 100644--- a/tests/mock_user_props_repo.go+++ b/tests/mock_user_props_repo.go@@ -53,7 +53,7 @@ func (p *MockedUserPropsRepo) DefaultGet(userId, key string, defaultValue stringp.init()v, err := p.Get(userId, key)if err != nil {- return defaultValue, nil+ return defaultValue, nil //nolint:nilerr}return v, nil}diff --git a/utils/cache/spread_fs.go b/utils/cache/spread_fs.goindex ef85e60c4..281e2bfab 100644--- a/utils/cache/spread_fs.go+++ b/utils/cache/spread_fs.go@@ -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