mirror of
https://github.com/navidrome/navidrome.git
synced 2025-04-15 19:50:37 +03:00
Fixing some lint warnings
This commit is contained in:
parent
9099e24413
commit
83e0a7b24c
@ -1,7 +1,6 @@
|
||||
package engine
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"strconv"
|
||||
"time"
|
||||
@ -42,7 +41,7 @@ func (b *browser) Indexes(ifModifiedSince time.Time) (domain.ArtistIndexes, time
|
||||
lastModified := utils.ToTime(ms)
|
||||
|
||||
if err != nil {
|
||||
return nil, time.Time{}, errors.New(fmt.Sprintf("error retrieving LastScan property: %v", err))
|
||||
return nil, time.Time{}, fmt.Errorf("error retrieving LastScan property: %v", err)
|
||||
}
|
||||
|
||||
if lastModified.After(ifModifiedSince) {
|
||||
|
@ -331,7 +331,7 @@ func (r *ledisRepository) loadFromSet(setName string, entities interface{}, qo .
|
||||
}
|
||||
|
||||
reflected := reflect.ValueOf(entities).Elem()
|
||||
var sortKey []byte = nil
|
||||
var sortKey []byte
|
||||
if o.SortBy != "" {
|
||||
sortKey = []byte(fmt.Sprintf("%s:*:%s", r.table, o.SortBy))
|
||||
}
|
||||
|
@ -143,7 +143,7 @@ func TestBaseRepository(t *testing.T) {
|
||||
})
|
||||
|
||||
Convey("And the number of children should be 1", func() {
|
||||
children := make([]TestEntity, 0)
|
||||
var children []TestEntity
|
||||
err := repo.loadChildren("parent", "ABC", &children)
|
||||
So(err, ShouldBeNil)
|
||||
So(len(children), ShouldEqual, 1)
|
||||
@ -241,7 +241,7 @@ func TestBaseRepository(t *testing.T) {
|
||||
So(count, ShouldEqual, 2)
|
||||
})
|
||||
Convey("And the deleted record shouldn't be among the children", func() {
|
||||
children := make([]TestEntity, 0)
|
||||
var children []TestEntity
|
||||
err := repo.loadChildren("parent", "AAA", &children)
|
||||
So(err, ShouldBeNil)
|
||||
So(len(children), ShouldEqual, 2)
|
||||
|
@ -6,8 +6,9 @@ import (
|
||||
"encoding/json"
|
||||
"encoding/xml"
|
||||
"fmt"
|
||||
|
||||
"github.com/deluan/gosonic/api/responses"
|
||||
. "github.com/smartystreets/goconvey/convey"
|
||||
"github.com/smartystreets/goconvey/convey"
|
||||
)
|
||||
|
||||
func ShouldMatchXML(actual interface{}, expected ...interface{}) string {
|
||||
@ -15,7 +16,7 @@ func ShouldMatchXML(actual interface{}, expected ...interface{}) string {
|
||||
if err != nil {
|
||||
return fmt.Sprintf("Malformed XML: %v", err)
|
||||
}
|
||||
return ShouldEqual(string(xml), expected[0].(string))
|
||||
return convey.ShouldEqual(string(xml), expected[0].(string))
|
||||
|
||||
}
|
||||
|
||||
@ -25,13 +26,13 @@ func ShouldMatchJSON(actual interface{}, expected ...interface{}) string {
|
||||
return fmt.Sprintf("Malformed JSON: %v", err)
|
||||
}
|
||||
s := UnindentJSON(json)
|
||||
return ShouldEqual(s, expected[0].(string))
|
||||
return convey.ShouldEqual(s, expected[0].(string))
|
||||
}
|
||||
|
||||
func ShouldContainJSON(actual interface{}, expected ...interface{}) string {
|
||||
a := UnindentJSON(actual.(*bytes.Buffer).Bytes())
|
||||
|
||||
return ShouldContainSubstring(a, expected[0].(string))
|
||||
return convey.ShouldContainSubstring(a, expected[0].(string))
|
||||
}
|
||||
|
||||
func ShouldReceiveError(actual interface{}, expected ...interface{}) string {
|
||||
@ -41,12 +42,12 @@ func ShouldReceiveError(actual interface{}, expected ...interface{}) string {
|
||||
return fmt.Sprintf("Malformed XML: %v", err)
|
||||
}
|
||||
|
||||
return ShouldEqual(v.Error.Code, expected[0].(int))
|
||||
return convey.ShouldEqual(v.Error.Code, expected[0].(int))
|
||||
}
|
||||
|
||||
func ShouldMatchMD5(actual interface{}, expected ...interface{}) string {
|
||||
a := fmt.Sprintf("%x", md5.Sum(actual.([]byte)))
|
||||
return ShouldEqual(a, expected[0].(string))
|
||||
return convey.ShouldEqual(a, expected[0].(string))
|
||||
}
|
||||
|
||||
func ShouldBeAValid(actual interface{}, expected ...interface{}) string {
|
||||
|
Loading…
x
Reference in New Issue
Block a user