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:44 -05:00
parent 152a84d7e5
commit dbaabe1f65
3 changed files with 13 additions and 13 deletions

10
main.go
View File

@@ -264,8 +264,8 @@ func main() {
if err != nil {
return "", err
}
part.Write(audioData)
w.Close()
_, _ = part.Write(audioData)
_ = w.Close()
req, err := http.NewRequestWithContext(ctx, http.MethodPost, whisperURL+"/v1/audio/transcriptions", &buf)
if err != nil {
@@ -277,7 +277,7 @@ func main() {
if err != nil {
return "", fmt.Errorf("whisper request: %w", err)
}
defer resp.Body.Close()
defer func() { _ = resp.Body.Close() }()
body, _ := io.ReadAll(resp.Body)
if resp.StatusCode >= 400 {
@@ -335,7 +335,7 @@ func main() {
State: state,
}
packed, _ := msgpack.Marshal(result)
nc.Conn().Publish(fmt.Sprintf("%s.%s", transcriptionSubjectPrefix, sessionID), packed)
_ = nc.Conn().Publish(fmt.Sprintf("%s.%s", transcriptionSubjectPrefix, sessionID), packed)
slog.Info("published transcription", "session", sessionID, "seq", seq)
}
@@ -448,7 +448,7 @@ func main() {
SpeakerID: buffer.speakerID,
}
packed, _ := msgpack.Marshal(interruptMsg)
nc.Conn().Publish(fmt.Sprintf("%s.%s", transcriptionSubjectPrefix, sessionID), packed)
_ = nc.Conn().Publish(fmt.Sprintf("%s.%s", transcriptionSubjectPrefix, sessionID), packed)
slog.Info("published interrupt", "session", sessionID)
buffer.setState(stateListening)
}