Use Go builtin min/max func

This commit is contained in:
Deluan 2024-02-16 21:48:25 -05:00
parent f7a4387d0e
commit 166eb37787
8 changed files with 18 additions and 74 deletions

View file

@ -12,7 +12,6 @@ import (
"github.com/navidrome/navidrome/conf"
"github.com/navidrome/navidrome/consts"
"github.com/navidrome/navidrome/utils"
"github.com/navidrome/navidrome/utils/number"
"github.com/navidrome/navidrome/utils/slice"
"golang.org/x/exp/slices"
)
@ -209,17 +208,16 @@ func allOrNothing(items []string) (string, int) {
}
func minMax(items []int) (int, int) {
var max = items[0]
var min = items[0]
var mn, mx = items[0], items[0]
for _, value := range items {
max = number.Max(max, value)
if min == 0 {
min = value
mx = max(mx, value)
if mn == 0 {
mn = value
} else if value > 0 {
min = number.Min(min, value)
mn = min(mn, value)
}
}
return min, max
return mn, mx
}
func newer(t1, t2 time.Time) time.Time {