🐛 fix lint: check the appsec stub write in the reuse test

errcheck flagged fmt.Fprint in the new test. Use rw.Write with the error
checked, and drop the now-unused fmt import.

Verified with golangci-lint v1.63.4 and go test under go1.22 in containers
matching CI, rather than the local go1.26 toolchain that made the linter
unusable.
This commit is contained in:
mhx
2026-09-03 08:59:12 +02:00
parent 60d6d57625
commit d7aa10477d
+3 -2
View File
@@ -2,7 +2,6 @@ package crowdsec_bouncer_traefik_plugin //nolint:revive,stylecheck
import (
"context"
"fmt"
"io"
"net/http"
"net/http/httptest"
@@ -576,7 +575,9 @@ func Test_appsecQuery_reusesConnection(t *testing.T) {
rw.WriteHeader(status)
// a non-empty body is what makes the connection unusable when it
// is not drained; an empty one is already at EOF
fmt.Fprint(rw, `{"action":"allow"}`)
if _, errWrite := rw.Write([]byte(`{"action":"allow"}`)); errWrite != nil {
t.Errorf("appsec stub write: %v", errWrite)
}
}))
defer appsecServer.Close()