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:
12
e2e_test.go
12
e2e_test.go
@@ -150,12 +150,12 @@ func TestTranscriptionE2E_MockWhisper(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Errorf("missing 'file' field: %v", err)
|
||||
} else {
|
||||
file.Close()
|
||||
_ = file.Close()
|
||||
}
|
||||
}
|
||||
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
json.NewEncoder(w).Encode(map[string]string{"text": "hello world"})
|
||||
_ = json.NewEncoder(w).Encode(map[string]string{"text": "hello world"})
|
||||
}))
|
||||
defer whisperSrv.Close()
|
||||
|
||||
@@ -166,20 +166,20 @@ func TestTranscriptionE2E_MockWhisper(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
part.Write(make([]byte, 8000)) // simulated audio
|
||||
writer.Close()
|
||||
_, _ = part.Write(make([]byte, 8000)) // simulated audio
|
||||
_ = writer.Close()
|
||||
|
||||
resp, err := http.Post(whisperSrv.URL+"/v1/audio/transcriptions", writer.FormDataContentType(), &buf)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
defer func() { _ = resp.Body.Close() }()
|
||||
if resp.StatusCode != 200 {
|
||||
t.Errorf("status = %d", resp.StatusCode)
|
||||
}
|
||||
|
||||
var result map[string]string
|
||||
json.NewDecoder(resp.Body).Decode(&result)
|
||||
_ = json.NewDecoder(resp.Body).Decode(&result)
|
||||
if result["text"] != "hello world" {
|
||||
t.Errorf("text = %q, want %q", result["text"], "hello world")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user