fix: resolve all lint errors and make linting a required CI check (#62)

- Fix 10 err113 violations: extract dynamic errors to package-level sentinels
- Fix 12 errcheck violations: handle unchecked error returns in player,
  metadata, and config packages
- Fix 4 revive stutter warnings: rename player.PlayerState to player.State,
  player.PlayerVolume to player.Volume, queue.QueueTrack to queue.Track,
  queue.QueueState to queue.State
- Fix 2 staticcheck SA4001: simplify *&x to x in assets handler
- Fix 5 unused constants: remove dead AudioFileType iota block in models
- Fix gci/gofumpt/wsl formatting issues across multiple files
- Add gofumpt module-path setting to .golangci.yml for correct import grouping
- Fix player test: gate integration test behind YELLOWJACKET_INTEGRATION env var
  instead of only skipping in CI, and replace t.Errorf+t.Failed with t.Fatalf
- Remove continue-on-error from golangci-lint CI step so linting is now required
This commit is contained in:
2026-02-14 01:52:27 -06:00
committed by GitHub
parent 2d6e22105d
commit 30b2480df4
16 changed files with 159 additions and 98 deletions
+14 -14
View File
@@ -3,8 +3,8 @@ package player
// UserVolume represents volume on a user-facing scale (0-100).
type UserVolume int
// PlayerVolume represents volume on an internal scale (-10 to 10).
type PlayerVolume float64
// Volume represents volume on an internal scale (-4 to 0).
type Volume float64
// User volume range bounds.
const (
@@ -12,31 +12,31 @@ const (
MaxUserVol UserVolume = 100
)
// Player volume range bounds.
// Internal volume range bounds.
const (
MinPlayerVol PlayerVolume = -4
MaxPlayerVol PlayerVolume = 0
MinVol Volume = -4
MaxVol Volume = 0
)
// ToPlayerVolume converts user volume to internal player volume.
func (oldVol UserVolume) ToPlayerVolume() PlayerVolume {
var newVol PlayerVolume
// ToVolume converts user volume to internal player volume.
func (oldVol UserVolume) ToVolume() Volume {
var newVol Volume
if oldVol >= MinUserVol && oldVol <= MaxUserVol {
ratio := PlayerVolume(oldVol-MinUserVol) / PlayerVolume(MaxUserVol-MinUserVol)
newVol = ratio*(MaxPlayerVol-MinPlayerVol) + MinPlayerVol
ratio := Volume(oldVol-MinUserVol) / Volume(MaxUserVol-MinUserVol)
newVol = ratio*(MaxVol-MinVol) + MinVol
}
return newVol
}
// ToUserVolume converts internal player volume to user volume.
func (oldVolFloat PlayerVolume) ToUserVolume() UserVolume {
func (oldVolFloat Volume) ToUserVolume() UserVolume {
var newVol UserVolume
if oldVolFloat >= MinPlayerVol && oldVolFloat <= MaxPlayerVol {
ratio := (oldVolFloat - MinPlayerVol) / (MaxPlayerVol - MinPlayerVol)
newVol = UserVolume(ratio*PlayerVolume(MaxUserVol-MinUserVol)) + MinUserVol
if oldVolFloat >= MinVol && oldVolFloat <= MaxVol {
ratio := (oldVolFloat - MinVol) / (MaxVol - MinVol)
newVol = UserVolume(ratio*Volume(MaxUserVol-MinUserVol)) + MinUserVol
}
return newVol