refactor: more warnings clean up

Signed-off-by: Deluan <deluan@navidrome.org>
This commit is contained in:
Deluan 2026-05-19 18:23:36 -03:00
parent efe9291db0
commit 03ac02d964
12 changed files with 12 additions and 24 deletions

View file

@ -1,7 +1,7 @@
package deezer package deezer
import ( import (
bytes "bytes" "bytes"
"context" "context"
"encoding/json" "encoding/json"
"errors" "errors"

View file

@ -123,14 +123,14 @@ func promptPassword() string {
for { for {
fmt.Print("Enter new password (press enter with no password to cancel): ") fmt.Print("Enter new password (press enter with no password to cancel): ")
// This cast is necessary for some platforms // This cast is necessary for some platforms
password, err := term.ReadPassword(int(syscall.Stdin)) //nolint:unconvert password, err := term.ReadPassword(syscall.Stdin) //nolint:unconvert
if err != nil { if err != nil {
log.Fatal("Error getting password", err) log.Fatal("Error getting password", err)
} }
fmt.Print("\nConfirm new password (press enter with no password to cancel): ") fmt.Print("\nConfirm new password (press enter with no password to cancel): ")
confirmation, err := term.ReadPassword(int(syscall.Stdin)) //nolint:unconvert confirmation, err := term.ReadPassword(syscall.Stdin) //nolint:unconvert
if err != nil { if err != nil {
log.Fatal("Error getting password confirmation", err) log.Fatal("Error getting password confirmation", err)

View file

@ -57,7 +57,7 @@ func (d *Dir) MustPath() string {
// GoString implements fmt.GoStringer so that %#v (used by pretty.Sprintf) // GoString implements fmt.GoStringer so that %#v (used by pretty.Sprintf)
// prints the path string instead of the internal struct fields. // prints the path string instead of the internal struct fields.
func (d Dir) GoString() string { //nolint:govet func (d Dir) GoString() string { //nolint:govet // uses a value receiver so Dir values satisfy GoStringer
return fmt.Sprintf("%q", d.path) return fmt.Sprintf("%q", d.path)
} }

View file

@ -21,7 +21,6 @@ func TestAuth(t *testing.T) {
} }
const ( const (
testJWTSecret = "not so secret"
oneDay = 24 * time.Hour oneDay = 24 * time.Hour
) )

View file

@ -7,7 +7,7 @@ import (
"path/filepath" "path/filepath"
"runtime" "runtime"
"strings" "strings"
sync "sync" "sync"
"testing" "testing"
"time" "time"

View file

@ -206,7 +206,7 @@ func (t *MpvTrack) IsPlaying() bool {
func waitForSocket(path string, timeout time.Duration, pause time.Duration) error { func waitForSocket(path string, timeout time.Duration, pause time.Duration) error {
start := time.Now() start := time.Now()
end := start.Add(timeout) end := start.Add(timeout)
var retries int = 0 var retries = 0
for { for {
fileInfo, err := os.Stat(path) fileInfo, err := os.Stat(path)

View file

@ -1,5 +1,3 @@
package criteria package criteria
var StartOfPeriod = startOfPeriod
type UnmarshalConjunctionType = unmarshalConjunctionType type UnmarshalConjunctionType = unmarshalConjunctionType

View file

@ -1,7 +1,5 @@
package criteria package criteria
import "time"
// Conjunctions need to implement this interface, to allow Criteria to extract child playlist IDs recursively // Conjunctions need to implement this interface, to allow Criteria to extract child playlist IDs recursively
type conjunction interface { type conjunction interface {
ChildPlaylistIds() []string ChildPlaylistIds() []string
@ -142,10 +140,6 @@ func (nitl NotInTheLast) MarshalJSON() ([]byte, error) {
func (nitl NotInTheLast) fields() map[string]any { return nitl } func (nitl NotInTheLast) fields() map[string]any { return nitl }
func startOfPeriod(numDays int64, from time.Time) string {
return from.Add(time.Duration(-24*numDays) * time.Hour).Format("2006-01-02")
}
type InPlaylist map[string]any type InPlaylist map[string]any
func (ipl InPlaylist) MarshalJSON() ([]byte, error) { func (ipl InPlaylist) MarshalJSON() ([]byte, error) {

View file

@ -11,10 +11,6 @@ import (
. "github.com/onsi/gomega" . "github.com/onsi/gomega"
) )
var (
NewId string = "123-456-789"
)
var _ = Describe("RadioRepository", func() { var _ = Describe("RadioRepository", func() {
var repo model.RadioRepository var repo model.RadioRepository
@ -139,7 +135,7 @@ var _ = Describe("RadioRepository", func() {
It("returns an existing item", func() { It("returns an existing item", func() {
res, err := repo.Get(radioWithHomePage.ID) res, err := repo.Get(radioWithHomePage.ID)
Expect(err).To((BeNil())) Expect(err).To(BeNil())
Expect(res.ID).To(Equal(radioWithHomePage.ID)) Expect(res.ID).To(Equal(radioWithHomePage.ID))
}) })

View file

@ -4,6 +4,7 @@ import (
"context" "context"
"os" "os"
"path/filepath" "path/filepath"
"strconv"
"time" "time"
"github.com/dustin/go-humanize" "github.com/dustin/go-humanize"
@ -143,7 +144,7 @@ var _ = Describe("purgeCacheBySize", func() {
// Create 5 files, 1MiB each (total 5MiB) // Create 5 files, 1MiB each (total 5MiB)
for i := range 5 { for i := range 5 {
path := filepath.Join(cacheDir, filepath.Join("dir", "file"+string(rune('0'+i))+".bin")) path := filepath.Join(cacheDir, filepath.Join("dir", "file"+strconv.Itoa(i)+".bin"))
createFileWithSize(path, 1*1024*1024, now.Add(-time.Duration(5-i)*time.Hour)) createFileWithSize(path, 1*1024*1024, now.Add(-time.Duration(5-i)*time.Hour))
} }

View file

@ -93,7 +93,7 @@ var _ = Describe("Tags", func() {
var t *Tags var t *Tags
BeforeEach(func() { BeforeEach(func() {
t = &Tags{Tags: map[string][]string{ t = &Tags{Tags: map[string][]string{
"fbpm": []string{"141.7"}, "fbpm": {"141.7"},
}} }}
}) })

View file

@ -134,7 +134,7 @@ var _ = Describe("Slice Utils", func() {
count := 0 count := 0
file, _ := os.Open(path) file, _ := os.Open(path)
defer file.Close() defer file.Close()
for _ = range slice.LinesFrom(file) { for range slice.LinesFrom(file) {
count++ count++
} }
Expect(count).To(Equal(expected)) Expect(count).To(Equal(expected))