fix: resolve golangci-lint errcheck warnings
Some checks failed
CI / Test (push) Has been cancelled
CI / Release (push) Has been cancelled
CI / Docker Build & Push (push) Has been cancelled
CI / Notify (push) Has been cancelled
CI / Lint (push) Has been cancelled

- Add error checks for unchecked return values (errcheck)
- Remove unused struct fields (unused)
- Fix gofmt formatting issues
This commit is contained in:
2026-02-20 08:45:42 -05:00
parent 3dff04ad95
commit ef52519d4d
3 changed files with 35 additions and 35 deletions

View File

@@ -19,11 +19,11 @@ func TestVoiceRegistryRefresh(t *testing.T) {
// Create a voice directory
voiceDir := filepath.Join(dir, "test-voice")
os.MkdirAll(voiceDir, 0o755)
_ = os.MkdirAll(voiceDir, 0o755)
info := map[string]string{"name": "test-voice", "language": "en", "type": "coqui-tts", "created_at": "2024-01-01"}
infoData, _ := json.Marshal(info)
os.WriteFile(filepath.Join(voiceDir, "model_info.json"), infoData, 0o644)
os.WriteFile(filepath.Join(voiceDir, "model.pth"), []byte("fake"), 0o644)
_ = os.WriteFile(filepath.Join(voiceDir, "model_info.json"), infoData, 0o644)
_ = os.WriteFile(filepath.Join(voiceDir, "model.pth"), []byte("fake"), 0o644)
vr := newVoiceRegistry(dir)
count := vr.refresh()
@@ -59,10 +59,10 @@ func TestVoiceRegistryMissing(t *testing.T) {
func TestVoiceRegistryNoModel(t *testing.T) {
dir := t.TempDir()
voiceDir := filepath.Join(dir, "bad-voice")
os.MkdirAll(voiceDir, 0o755)
_ = os.MkdirAll(voiceDir, 0o755)
info := map[string]string{"name": "bad-voice"}
infoData, _ := json.Marshal(info)
os.WriteFile(filepath.Join(voiceDir, "model_info.json"), infoData, 0o644)
_ = os.WriteFile(filepath.Join(voiceDir, "model_info.json"), infoData, 0o644)
// No model.pth
vr := newVoiceRegistry(dir)
@@ -82,12 +82,12 @@ func TestSynthesizeHTTP(t *testing.T) {
}
var payload map[string]any
json.NewDecoder(r.Body).Decode(&payload)
_ = json.NewDecoder(r.Body).Decode(&payload)
if payload["text"] != "hello" {
t.Errorf("unexpected text: %v", payload["text"])
}
w.Write([]byte{0x01, 0x02, 0x03, 0x04})
_, _ = w.Write([]byte{0x01, 0x02, 0x03, 0x04})
}))
defer ts.Close()
@@ -98,7 +98,7 @@ func TestSynthesizeHTTP(t *testing.T) {
if err != nil {
t.Fatal(err)
}
defer resp.Body.Close()
defer func() { _ = resp.Body.Close() }()
if resp.StatusCode != 200 {
t.Errorf("status = %d, want 200", resp.StatusCode)
}