mirror of
https://github.com/navidrome/navidrome.git
synced 2025-04-01 19:47:37 +03:00
Upgrade Go to 1.23 (#3190)
* Upgrade to Golang 1.23rc1 * Fix imports * Go 1.23 final version * Fix lint compatibility with ci-goreleaser
This commit is contained in:
parent
0c33523f45
commit
c4bd0e67fa
6 changed files with 17 additions and 15 deletions
|
@ -4,6 +4,8 @@ import (
|
|||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
"maps"
|
||||
"slices"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
|
@ -14,7 +16,6 @@ import (
|
|||
"github.com/navidrome/navidrome/model/request"
|
||||
"github.com/navidrome/navidrome/utils/cache"
|
||||
"github.com/navidrome/navidrome/utils/pl"
|
||||
"golang.org/x/exp/maps"
|
||||
)
|
||||
|
||||
type CacheWarmer interface {
|
||||
|
@ -94,7 +95,7 @@ func (a *cacheWarmer) run(ctx context.Context) {
|
|||
continue
|
||||
}
|
||||
|
||||
batch := maps.Keys(a.buffer)
|
||||
batch := slices.Collect(maps.Keys(a.buffer))
|
||||
a.buffer = make(map[model.ArtworkID]struct{})
|
||||
a.mutex.Unlock()
|
||||
|
||||
|
|
|
@ -114,7 +114,7 @@ func (pd *Queue) getMediaFileIndexByID(id string) (int, error) {
|
|||
return idx, nil
|
||||
}
|
||||
}
|
||||
return -1, fmt.Errorf("ID not found in playlist: " + id)
|
||||
return -1, fmt.Errorf("ID not found in playlist: %s", id)
|
||||
}
|
||||
|
||||
// Sets the index to a new, valid value inside the Items. Values lower than zero are going to be zero,
|
||||
|
|
4
go.mod
4
go.mod
|
@ -1,8 +1,10 @@
|
|||
module github.com/navidrome/navidrome
|
||||
|
||||
// This must match the ci-goreleaser Go version
|
||||
go 1.22
|
||||
|
||||
toolchain go1.22.3
|
||||
// This is the version used by the project
|
||||
toolchain go1.23.0
|
||||
|
||||
require (
|
||||
github.com/Masterminds/squirrel v1.5.4
|
||||
|
|
|
@ -3,7 +3,9 @@ package scanner
|
|||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"maps"
|
||||
"path/filepath"
|
||||
"slices"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
|
@ -13,7 +15,6 @@ import (
|
|||
"github.com/navidrome/navidrome/log"
|
||||
"github.com/navidrome/navidrome/model"
|
||||
"github.com/navidrome/navidrome/utils/slice"
|
||||
"golang.org/x/exp/maps"
|
||||
)
|
||||
|
||||
// refresher is responsible for rolling up mediafiles attributes into albums attributes,
|
||||
|
@ -71,7 +72,7 @@ func (r *refresher) flushMap(ctx context.Context, m map[string]struct{}, entity
|
|||
return nil
|
||||
}
|
||||
|
||||
ids := maps.Keys(m)
|
||||
ids := slices.Collect(maps.Keys(m))
|
||||
chunks := slice.BreakUp(ids, 100)
|
||||
for _, chunk := range chunks {
|
||||
err := refresh(ctx, chunk...)
|
||||
|
|
|
@ -2,13 +2,13 @@ package tests
|
|||
|
||||
import (
|
||||
"errors"
|
||||
"maps"
|
||||
"slices"
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/navidrome/navidrome/utils/slice"
|
||||
"golang.org/x/exp/maps"
|
||||
|
||||
"github.com/navidrome/navidrome/model"
|
||||
"github.com/navidrome/navidrome/utils/slice"
|
||||
)
|
||||
|
||||
func CreateMockMediaFileRepo() *MockMediaFileRepo {
|
||||
|
@ -56,7 +56,7 @@ func (m *MockMediaFileRepo) GetAll(...model.QueryOptions) (model.MediaFiles, err
|
|||
if m.err {
|
||||
return nil, errors.New("error")
|
||||
}
|
||||
values := maps.Values(m.data)
|
||||
values := slices.Collect(maps.Values(m.data))
|
||||
return slice.Map(values, func(p *model.MediaFile) model.MediaFile {
|
||||
return *p
|
||||
}), nil
|
||||
|
|
|
@ -5,9 +5,8 @@ import (
|
|||
"errors"
|
||||
"io"
|
||||
"io/fs"
|
||||
"maps"
|
||||
"slices"
|
||||
|
||||
"golang.org/x/exp/maps"
|
||||
)
|
||||
|
||||
// FS implements a simple merged fs.FS, that can combine a Base FS with an Overlay FS. The semantics are:
|
||||
|
@ -64,9 +63,8 @@ func (m FS) mergeDirs(name string, info fs.FileInfo, baseDir fs.ReadDirFile, ove
|
|||
for _, f := range overlayFiles {
|
||||
merged[f.Name()] = f
|
||||
}
|
||||
entries := maps.Values(merged)
|
||||
|
||||
slices.SortFunc(entries, func(i, j fs.DirEntry) int { return cmp.Compare(i.Name(), j.Name()) })
|
||||
it := maps.Values(merged)
|
||||
entries := slices.SortedFunc(it, func(i, j fs.DirEntry) int { return cmp.Compare(i.Name(), j.Name()) })
|
||||
return &mergedDir{
|
||||
name: name,
|
||||
info: info,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue