fix: resolve golangci-lint errcheck warnings
- Add error checks for unchecked return values (errcheck) - Remove unused struct fields (unused) - Fix gofmt formatting issues
This commit is contained in:
10
main.go
10
main.go
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user