chore(deps)!: bump to go1.25

fixes #594

Release-As: 0.18.0
This commit is contained in:
sentriz
2025-09-06 23:38:04 +01:00
parent db97bc753e
commit 1bf4a5b0c1
18 changed files with 45 additions and 63 deletions

No files matched your search

+1 -1
View File
@@ -36,7 +36,7 @@ jobs:
uses: golangci/golangci-lint-action@v8 uses: golangci/golangci-lint-action@v8
with: with:
install-mode: goinstall install-mode: goinstall
version: v2.3.0 version: v2.4.0
- name: Test - name: Test
run: go test ./... run: go test ./...
build-release: build-release:
+1 -1
View File
@@ -22,7 +22,7 @@ jobs:
uses: golangci/golangci-lint-action@v8 uses: golangci/golangci-lint-action@v8
with: with:
install-mode: goinstall install-mode: goinstall
version: v2.3.0 version: v2.4.0
- name: Test - name: Test
run: go test ./... run: go test ./...
release-please: release-please:
+1 -1
View File
@@ -23,6 +23,6 @@ jobs:
uses: golangci/golangci-lint-action@v8 uses: golangci/golangci-lint-action@v8
with: with:
install-mode: goinstall install-mode: goinstall
version: v2.3.0 version: v2.4.0
- name: Test - name: Test
run: go test ./... run: go test ./...
+1 -1
View File
@@ -7,7 +7,7 @@ RUN apk update && \
abuild-keygen -a -n -i && \ abuild-keygen -a -n -i && \
REPODEST=/pkgs abuild -F -r REPODEST=/pkgs abuild -F -r
FROM golang:1.24-alpine3.22 AS builder FROM golang:1.25-alpine3.22 AS builder
RUN apk add -U --no-cache \ RUN apk add -U --no-cache \
build-base \ build-base \
ca-certificates \ ca-certificates \
+4 -7
View File
@@ -67,7 +67,7 @@ func (db *DB) InsertBulkLeftMany(table string, head []string, left int, col []in
return nil return nil
} }
var rows []string var rows []string
var values []interface{} var values []any
for _, c := range col { for _, c := range col {
rows = append(rows, "(?, ?)") rows = append(rows, "(?, ?)")
values = append(values, left, c) values = append(values, left, c)
@@ -138,10 +138,7 @@ func (db *DB) TransactionChunked(data []int64, cb func(*DB, []int64) error) erro
const size = 999 const size = 999
return db.Transaction(func(tx *DB) error { return db.Transaction(func(tx *DB) error {
for i := 0; i < len(data); i += size { for i := 0; i < len(data); i += size {
end := i + size end := min(i+size, len(data))
if end > len(data) {
end = len(data)
}
if err := cb(tx, data[i:end]); err != nil { if err := cb(tx, data[i:end]); err != nil {
return err return err
} }
@@ -643,8 +640,8 @@ func Dump(ctx context.Context, db *gorm.DB, to string) error {
} }
defer connDest.Close() defer connDest.Close()
err = connDest.Raw(func(connDest interface{}) error { err = connDest.Raw(func(connDest any) error {
return connSrc.Raw(func(connSrc interface{}) error { return connSrc.Raw(func(connSrc any) error {
connDestq := connDest.(*sqlite3.SQLiteConn) connDestq := connDest.(*sqlite3.SQLiteConn)
connSrcq := connSrc.(*sqlite3.SQLiteConn) connSrcq := connSrc.(*sqlite3.SQLiteConn)
bk, err := connDestq.Backup("main", connSrcq, "main") bk, err := connDestq.Backup("main", connSrcq, "main")
+5 -7
View File
@@ -1,6 +1,6 @@
module go.senan.xyz/gonic module go.senan.xyz/gonic
go 1.24 go 1.25
require ( require (
github.com/Masterminds/sprig v2.22.0+incompatible github.com/Masterminds/sprig v2.22.0+incompatible
@@ -27,9 +27,9 @@ require (
github.com/rainycape/unidecode v0.0.0-20150907023854-cb7f23ec59be github.com/rainycape/unidecode v0.0.0-20150907023854-cb7f23ec59be
github.com/sentriz/audiotags v0.0.0-20240918190302-048d6470aae6 github.com/sentriz/audiotags v0.0.0-20240918190302-048d6470aae6
github.com/sentriz/gormstore v0.0.0-20220105134332-64e31f7f6981 github.com/sentriz/gormstore v0.0.0-20220105134332-64e31f7f6981
github.com/stretchr/testify v1.10.0 github.com/stretchr/testify v1.11.1
go.senan.xyz/flagconf v0.1.9 go.senan.xyz/flagconf v0.1.9
go.senan.xyz/wrtag v0.16.0 go.senan.xyz/wrtag v0.17.1
golang.org/x/net v0.43.0 golang.org/x/net v0.43.0
golang.org/x/sync v0.16.0 golang.org/x/sync v0.16.0
gopkg.in/gormigrate.v1 v1.6.0 gopkg.in/gormigrate.v1 v1.6.0
@@ -41,18 +41,16 @@ require (
github.com/PuerkitoBio/goquery v1.10.3 // indirect github.com/PuerkitoBio/goquery v1.10.3 // indirect
github.com/aymerick/douceur v0.2.0 // indirect github.com/aymerick/douceur v0.2.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect github.com/davecgh/go-spew v1.1.1 // indirect
github.com/go-openapi/jsonpointer v0.21.2 // indirect github.com/go-openapi/jsonpointer v0.22.0 // indirect
github.com/go-openapi/swag v0.23.1 // indirect github.com/go-openapi/swag/jsonname v0.24.0 // indirect
github.com/gorilla/context v1.1.2 // indirect github.com/gorilla/context v1.1.2 // indirect
github.com/gorilla/css v1.0.1 // indirect github.com/gorilla/css v1.0.1 // indirect
github.com/huandu/xstrings v1.5.0 // indirect github.com/huandu/xstrings v1.5.0 // indirect
github.com/imdario/mergo v0.3.16 // indirect github.com/imdario/mergo v0.3.16 // indirect
github.com/jinzhu/inflection v1.0.0 // indirect github.com/jinzhu/inflection v1.0.0 // indirect
github.com/jinzhu/now v1.1.2 // indirect github.com/jinzhu/now v1.1.2 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect github.com/json-iterator/go v1.1.12 // indirect
github.com/lib/pq v1.3.0 // indirect github.com/lib/pq v1.3.0 // indirect
github.com/mailru/easyjson v0.9.0 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/mmcdole/goxpp v1.1.1 // indirect github.com/mmcdole/goxpp v1.1.1 // indirect
+8 -12
View File
@@ -35,10 +35,10 @@ github.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo=
github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M=
github.com/fsnotify/fsnotify v1.9.0 h1:2Ml+OJNzbYCTzsxtv8vKSFD9PbJjmhYF14k/jKC7S9k= github.com/fsnotify/fsnotify v1.9.0 h1:2Ml+OJNzbYCTzsxtv8vKSFD9PbJjmhYF14k/jKC7S9k=
github.com/fsnotify/fsnotify v1.9.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0= github.com/fsnotify/fsnotify v1.9.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0=
github.com/go-openapi/jsonpointer v0.21.2 h1:AqQaNADVwq/VnkCmQg6ogE+M3FOsKTytwges0JdwVuA= github.com/go-openapi/jsonpointer v0.22.0 h1:TmMhghgNef9YXxTu1tOopo+0BGEytxA+okbry0HjZsM=
github.com/go-openapi/jsonpointer v0.21.2/go.mod h1:50I1STOfbY1ycR8jGz8DaMeLCdXiI6aDteEdRNNzpdk= github.com/go-openapi/jsonpointer v0.22.0/go.mod h1:xt3jV88UtExdIkkL7NloURjRQjbeUgcxFblMjq2iaiU=
github.com/go-openapi/swag v0.23.1 h1:lpsStH0n2ittzTnbaSloVZLuB5+fvSY/+hnagBjSNZU= github.com/go-openapi/swag/jsonname v0.24.0 h1:2wKS9bgRV/xB8c62Qg16w4AUiIrqqiniJFtZGi3dg5k=
github.com/go-openapi/swag v0.23.1/go.mod h1:STZs8TbRvEQQKUA+JZNAm3EWlgaOBGpyFDqQnDHMef0= github.com/go-openapi/swag/jsonname v0.24.0/go.mod h1:GXqrPzGJe611P7LG4QB9JKPtUZ7flE4DOVechNaDd7Q=
github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w=
github.com/go-sql-driver/mysql v1.5.0 h1:ozyZYNQW3x3HtqT1jira07DN2PArx2v7/mN66gGcHOs= github.com/go-sql-driver/mysql v1.5.0 h1:ozyZYNQW3x3HtqT1jira07DN2PArx2v7/mN66gGcHOs=
github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
@@ -84,8 +84,6 @@ github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc=
github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg= github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg=
github.com/josephburnett/jd v1.9.2 h1:ECJRRFXCCqbtidkAHckHGSZm/JIaAxS1gygHLF8MI5Y= github.com/josephburnett/jd v1.9.2 h1:ECJRRFXCCqbtidkAHckHGSZm/JIaAxS1gygHLF8MI5Y=
github.com/josephburnett/jd v1.9.2/go.mod h1:bImDr8QXpxMb3SD+w1cDRHp97xP6UwI88xUAuxwDQfM= github.com/josephburnett/jd v1.9.2/go.mod h1:bImDr8QXpxMb3SD+w1cDRHp97xP6UwI88xUAuxwDQfM=
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
@@ -96,8 +94,6 @@ github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
github.com/lib/pq v1.1.1/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.1.1/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
github.com/lib/pq v1.3.0 h1:/qkRGz8zljWiDcFvgpwUpwIAPu3r07TDvs3Rws+o/pU= github.com/lib/pq v1.3.0 h1:/qkRGz8zljWiDcFvgpwUpwIAPu3r07TDvs3Rws+o/pU=
github.com/lib/pq v1.3.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.3.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
github.com/mailru/easyjson v0.9.0 h1:PrnmzHw7262yW8sTBwxi1PdJA3Iw/EKBa8psRf7d9a4=
github.com/mailru/easyjson v0.9.0/go.mod h1:1+xMtQp2MRNVL/V1bOzuP3aP8VNwRW55fQUto+XFtTU=
github.com/mattn/go-sqlite3 v1.10.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= github.com/mattn/go-sqlite3 v1.10.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
github.com/mattn/go-sqlite3 v1.14.0/go.mod h1:JIl7NbARA7phWnGvh0LKTyg7S9BA+6gx71ShQilpsus= github.com/mattn/go-sqlite3 v1.14.0/go.mod h1:JIl7NbARA7phWnGvh0LKTyg7S9BA+6gx71ShQilpsus=
github.com/mattn/go-sqlite3 v1.14.32 h1:JD12Ag3oLy1zQA+BNn74xRgaBbdhbNIDYvQUEuuErjs= github.com/mattn/go-sqlite3 v1.14.32 h1:JD12Ag3oLy1zQA+BNn74xRgaBbdhbNIDYvQUEuuErjs=
@@ -135,13 +131,13 @@ github.com/sentriz/gormstore v0.0.0-20220105134332-64e31f7f6981 h1:sLILANWN76ja6
github.com/sentriz/gormstore v0.0.0-20220105134332-64e31f7f6981/go.mod h1:Rx8XB1ck+so+41uu9VY1gMKs1CPQ2NTq0pzf+OCCQHo= github.com/sentriz/gormstore v0.0.0-20220105134332-64e31f7f6981/go.mod h1:Rx8XB1ck+so+41uu9VY1gMKs1CPQ2NTq0pzf+OCCQHo=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
go.senan.xyz/flagconf v0.1.9 h1:LBDmqiVFgijfqFXDzH97gPn0qDbg1Dq6/vxsxS/TzC4= go.senan.xyz/flagconf v0.1.9 h1:LBDmqiVFgijfqFXDzH97gPn0qDbg1Dq6/vxsxS/TzC4=
go.senan.xyz/flagconf v0.1.9/go.mod h1:NqOFfSwJvNWXOTUabcRZ8mPK9+sJmhStJhqtEt74wNQ= go.senan.xyz/flagconf v0.1.9/go.mod h1:NqOFfSwJvNWXOTUabcRZ8mPK9+sJmhStJhqtEt74wNQ=
go.senan.xyz/wrtag v0.16.0 h1:Txcl4OXwfLe5PO7agfRGaRD00GLji5wn9qwLFD/aR1E= go.senan.xyz/wrtag v0.17.1 h1:QC40z0rRAZ8zjIwwIrFIhldviP9cW0Jpe9EDh5Bt2J8=
go.senan.xyz/wrtag v0.16.0/go.mod h1:XAbiIGbf0DP22RcQBW1n1KeeUTGQU9B6k5A6CGw2j4A= go.senan.xyz/wrtag v0.17.1/go.mod h1:rrC+QaFcZACW/hcsZpQj6kTh69rjhxIoePk3MZG3/rA=
golang.org/x/crypto v0.0.0-20181112202954-3d3f9f413869/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181112202954-3d3f9f413869/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
+4 -4
View File
@@ -116,12 +116,12 @@ func (m *MockFS) AddItemsWithCovers() { m.addItems("", "", tr
func (m *MockFS) AddItemsPrefixWithCovers(prefix string) { m.addItems(prefix, "", true) } func (m *MockFS) AddItemsPrefixWithCovers(prefix string) { m.addItems(prefix, "", true) }
func (m *MockFS) addItems(prefix string, onlyGlob string, covers bool) { func (m *MockFS) addItems(prefix string, onlyGlob string, covers bool) {
p := func(format string, a ...interface{}) string { p := func(format string, a ...any) string {
return filepath.Join(prefix, fmt.Sprintf(format, a...)) return filepath.Join(prefix, fmt.Sprintf(format, a...))
} }
for ar := 0; ar < 3; ar++ { for ar := range 3 {
for al := 0; al < 3; al++ { for al := range 3 {
for tr := 0; tr < 3; tr++ { for tr := range 3 {
path := p("artist-%d/album-%d/track-%d.flac", ar, al, tr) path := p("artist-%d/album-%d/track-%d.flac", ar, al, tr)
if !match(onlyGlob, path) { if !match(onlyGlob, path) {
continue continue
+4 -5
View File
@@ -9,21 +9,20 @@ import (
func BenchmarkScanIncremental(b *testing.B) { func BenchmarkScanIncremental(b *testing.B) {
m := mockfs.New(b) m := mockfs.New(b)
for i := 0; i < 5; i++ { for i := range 5 {
m.AddItemsPrefix(fmt.Sprintf("t-%d", i)) m.AddItemsPrefix(fmt.Sprintf("t-%d", i))
} }
m.ScanAndClean() m.ScanAndClean()
b.ResetTimer()
for i := 0; i < b.N; i++ { for b.Loop() {
m.ScanAndClean() m.ScanAndClean()
} }
} }
func BenchmarkScanFull(b *testing.B) { func BenchmarkScanFull(b *testing.B) {
for i := 0; i < b.N; i++ { for b.Loop() {
m := mockfs.New(b) m := mockfs.New(b)
for i := 0; i < 5; i++ { for i := range 5 {
m.AddItemsPrefix(fmt.Sprintf("t-%d", i)) m.AddItemsPrefix(fmt.Sprintf("t-%d", i))
} }
b.StartTimer() b.StartTimer()
+1 -1
View File
@@ -43,7 +43,7 @@ func FuzzScanner(f *testing.F) {
}) })
} }
func fuzzStruct(taken int, data []byte, seed int64, dest interface{}) { func fuzzStruct(taken int, data []byte, seed int64, dest any) {
if len(data) == 0 { if len(data) == 0 {
return return
} }
+3 -3
View File
@@ -363,7 +363,7 @@ func TestNewAlbumForExistingArtist(t *testing.T) {
assert.NoError(t, m.DB().Where("name=?", "artist-2").Find(&artist).Error) // find orig artist assert.NoError(t, m.DB().Where("name=?", "artist-2").Find(&artist).Error) // find orig artist
assert.Greater(t, artist.ID, 0) assert.Greater(t, artist.ID, 0)
for tr := 0; tr < 3; tr++ { for tr := range 3 {
m.AddTrack(fmt.Sprintf("artist-2/new-album/track-%d.mp3", tr)) m.AddTrack(fmt.Sprintf("artist-2/new-album/track-%d.mp3", tr))
m.SetTags(fmt.Sprintf("artist-2/new-album/track-%d.mp3", tr), func(tags *mockfs.TagInfo) { m.SetTags(fmt.Sprintf("artist-2/new-album/track-%d.mp3", tr), func(tags *mockfs.TagInfo) {
tags.RawArtist = "artist-2" tags.RawArtist = "artist-2"
@@ -552,7 +552,7 @@ func TestCompilationAlbumWithoutAlbumArtist(t *testing.T) {
const toAdd = 5 const toAdd = 5
// add tracks to one folder with random artists and no album artist tag // add tracks to one folder with random artists and no album artist tag
for i := 0; i < toAdd; i++ { for i := range toAdd {
p := fmt.Sprintf("%s/%s/track-%d.flac", pathArtist, pathAlbum, i) p := fmt.Sprintf("%s/%s/track-%d.flac", pathArtist, pathAlbum, i)
m.AddTrack(p) m.AddTrack(p)
m.SetTags(p, func(tags *mockfs.TagInfo) { m.SetTags(p, func(tags *mockfs.TagInfo) {
@@ -605,7 +605,7 @@ func TestAlbumAndArtistSameNameWeirdness(t *testing.T) {
const name = "same" const name = "same"
add := func(path string, a ...interface{}) { add := func(path string, a ...any) {
m.AddTrack(fmt.Sprintf(path, a...)) m.AddTrack(fmt.Sprintf(path, a...))
m.SetTags(fmt.Sprintf(path, a...), func(tags *mockfs.TagInfo) {}) m.SetTags(fmt.Sprintf(path, a...), func(tags *mockfs.TagInfo) {})
} }
+1 -1
View File
@@ -271,7 +271,7 @@ func respRaw(h http.HandlerFunc) http.Handler {
type templateData struct { type templateData struct {
// common // common
Flashes []interface{} Flashes []any
User *db.User User *db.User
Version string Version string
-1
View File
@@ -87,7 +87,6 @@ func makeHTTPMockWithAdmin(query url.Values) (*httptest.ResponseRecorder, *http.
func runQueryCases(t *testing.T, h handlerSubsonic, cases []*queryCase) { func runQueryCases(t *testing.T, h handlerSubsonic, cases []*queryCase) {
t.Helper() t.Helper()
for _, qc := range cases { for _, qc := range cases {
qc := qc
t.Run(qc.expectPath, func(t *testing.T) { t.Run(qc.expectPath, func(t *testing.T) {
t.Helper() t.Helper()
t.Parallel() t.Parallel()
+2 -4
View File
@@ -155,11 +155,9 @@ func coverScaleAndSave(reader io.Reader, cachePath string, size int) error {
if err != nil { if err != nil {
return fmt.Errorf("resizing: %w", err) return fmt.Errorf("resizing: %w", err)
} }
width := size width := min(size,
if width > src.Bounds().Dx() {
// don't upscale images // don't upscale images
width = src.Bounds().Dx() src.Bounds().Dx())
}
if err := imaging.Save(imaging.Resize(src, width, 0, imaging.Lanczos), cachePath); err != nil { if err := imaging.Save(imaging.Resize(src, width, 0, imaging.Lanczos), cachePath); err != nil {
return fmt.Errorf("caching %q: %w", cachePath, err) return fmt.Errorf("caching %q: %w", cachePath, err)
} }
+3 -4
View File
@@ -27,6 +27,7 @@ package params
import ( import (
"errors" "errors"
"maps"
"net/http" "net/http"
"net/url" "net/url"
"strconv" "strconv"
@@ -44,9 +45,7 @@ func New(r *http.Request) Params {
params := r.URL.Query() params := r.URL.Query()
// also if there's any in the post body, use those too // also if there's any in the post body, use those too
if err := r.ParseForm(); err == nil { if err := r.ParseForm(); err == nil {
for k, v := range r.Form { maps.Copy(params, r.Form)
params[k] = v
}
} }
return Params(params) return Params(params)
} }
@@ -389,7 +388,7 @@ func parseTime(in string) (time.Time, error) {
return time.Unix(0, ns), nil return time.Unix(0, ns), nil
} }
func parse(values []string, i interface{}) error { func parse(values []string, i any) error {
if len(values) == 0 { if len(values) == 0 {
return ErrNoValues return ErrNoValues
} }
+3 -3
View File
@@ -102,7 +102,7 @@ type Error struct {
Message string `xml:"message,attr" json:"message"` Message string `xml:"message,attr" json:"message"`
} }
func NewError(code int, message string, a ...interface{}) *Response { func NewError(code int, message string, a ...any) *Response {
r := NewResponse() r := NewResponse()
r.Status = "failed" r.Status = "failed"
r.Error = &Error{ r.Error = &Error{
@@ -128,7 +128,7 @@ type GenreRef struct {
// https://opensubsonic.netlify.app/docs/responses/albumid3/ // https://opensubsonic.netlify.app/docs/responses/albumid3/
type Album struct { type Album struct {
ID *specid.ID `xml:"id,attr,omitempty" json:"id"` ID *specid.ID `xml:"id,attr,omitempty" json:"id"`
Created time.Time `xml:"created,attr,omitempty" json:"created,omitempty"` Created time.Time `xml:"created,attr,omitempty" json:"created"`
// legacy or single tag mode // legacy or single tag mode
ArtistID *specid.ID `xml:"artistId,attr,omitempty" json:"artistId,omitempty"` ArtistID *specid.ID `xml:"artistId,attr,omitempty" json:"artistId,omitempty"`
@@ -201,7 +201,7 @@ type TrackChild struct {
Bitrate int `xml:"bitRate,attr,omitempty" json:"bitRate,omitempty"` Bitrate int `xml:"bitRate,attr,omitempty" json:"bitRate,omitempty"`
ContentType string `xml:"contentType,attr,omitempty" json:"contentType,omitempty"` ContentType string `xml:"contentType,attr,omitempty" json:"contentType,omitempty"`
CoverID *specid.ID `xml:"coverArt,attr,omitempty" json:"coverArt,omitempty"` CoverID *specid.ID `xml:"coverArt,attr,omitempty" json:"coverArt,omitempty"`
CreatedAt time.Time `xml:"created,attr,omitempty" json:"created,omitempty"` CreatedAt time.Time `xml:"created,attr,omitempty" json:"created"`
Duration int `xml:"duration,attr,omitempty" json:"duration,omitempty"` Duration int `xml:"duration,attr,omitempty" json:"duration,omitempty"`
Genre string `xml:"genre,attr,omitempty" json:"genre,omitempty"` Genre string `xml:"genre,attr,omitempty" json:"genre,omitempty"`
Genres []*GenreRef `xml:"genres,omitempty" json:"genres,omitempty"` Genres []*GenreRef `xml:"genres,omitempty" json:"genres,omitempty"`
-1
View File
@@ -24,7 +24,6 @@ func TestParseID(t *testing.T) {
} }
for _, tcase := range tcases { for _, tcase := range tcases {
tcase := tcase // pin
t.Run(tcase.param, func(t *testing.T) { t.Run(tcase.param, func(t *testing.T) {
t.Parallel() t.Parallel()
+3 -6
View File
@@ -116,15 +116,12 @@ func TestCachingParallelism(t *testing.T) {
cacheTranscoder := transcode.NewCachingTranscoder(transcoder, t.TempDir(), 1024) cacheTranscoder := transcode.NewCachingTranscoder(transcoder, t.TempDir(), 1024)
var wg sync.WaitGroup var wg sync.WaitGroup
for i := 0; i < 5; i++ { for range 5 {
wg.Add(1) wg.Go(func() {
go func() {
defer wg.Done()
var buf bytes.Buffer var buf bytes.Buffer
require.NoError(t, cacheTranscoder.Transcode(context.Background(), transcode.PCM16le, "testdata/5s.flac", &buf)) require.NoError(t, cacheTranscoder.Transcode(context.Background(), transcode.PCM16le, "testdata/5s.flac", &buf))
require.Equal(t, 5*bytesPerSec, buf.Len()) require.Equal(t, 5*bytesPerSec, buf.Len())
}() })
} }
wg.Wait() wg.Wait()