mirror of
https://github.com/navidrome/navidrome.git
synced 2026-11-27 12:29:50 +01:00
refactor: multiple syntax updates for Go 1.26
Signed-off-by: Deluan <deluan@navidrome.org>
This commit is contained in:
parent
545a9ecc3c
commit
efe9291db0
51 changed files with 143 additions and 251 deletions
3
utils/cache/cached_http_client.go
vendored
3
utils/cache/cached_http_client.go
vendored
|
|
@ -75,8 +75,7 @@ func (c *HTTPClient) serializeReq(req *http.Request) string {
|
|||
}
|
||||
if req.Body != nil {
|
||||
bodyData, _ := io.ReadAll(req.Body)
|
||||
bodyStr := base64.StdEncoding.EncodeToString(bodyData)
|
||||
data.Body = &bodyStr
|
||||
data.Body = new(base64.StdEncoding.EncodeToString(bodyData))
|
||||
}
|
||||
j, _ := json.Marshal(&data)
|
||||
return string(j)
|
||||
|
|
|
|||
3
utils/cache/simple_cache.go
vendored
3
utils/cache/simple_cache.go
vendored
|
|
@ -9,7 +9,6 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/jellydator/ttlcache/v3"
|
||||
. "github.com/navidrome/navidrome/utils/gg"
|
||||
)
|
||||
|
||||
type SimpleCache[K comparable, V any] interface {
|
||||
|
|
@ -119,7 +118,7 @@ func (c *simpleCache[K, V]) GetWithLoader(key K, loader func(key K) (V, time.Dur
|
|||
func (c *simpleCache[K, V]) evictExpired() {
|
||||
if c.evictionDeadline.Load() == nil || c.evictionDeadline.Load().Before(time.Now()) {
|
||||
c.data.DeleteExpired()
|
||||
c.evictionDeadline.Store(P(time.Now().Add(evictionTimeout)))
|
||||
c.evictionDeadline.Store(new(time.Now().Add(evictionTimeout)))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue