remove globals

This commit is contained in:
sentriz
2020-05-03 04:43:00 +01:00
committed by Senan Kelly
parent 1ef2d43d39
commit 31b8b758ed

View File

@@ -33,6 +33,10 @@ import (
"go.senan.xyz/gonic/server/ctrlsubsonic/specid"
)
var (
ErrNoValues = errors.New("no values provided")
)
// some thin wrappers
// may be needed when cleaning up parse() below
func parseStr(in string) (string, error) { return in, nil }
@@ -42,7 +46,7 @@ func parseBool(in string) (bool, error) { return strconv.ParseBool(in) }
func parse(values []string, i interface{}) error {
if len(values) == 0 {
return errors.New("no values provided")
return ErrNoValues
}
var err error
switch v := i.(type) {