mirror of
https://github.com/maxlerebourg/crowdsec-bouncer-traefik-plugin.git
synced 2026-09-04 21:18:52 +02:00
🐛 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:
+3
-2
@@ -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()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user