From d7aa10477d50ac695489de72fe8929c737792319 Mon Sep 17 00:00:00 2001 From: mhx Date: Thu, 3 Sep 2026 08:59:12 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix=20lint:=20check=20the=20apps?= =?UTF-8?q?ec=20stub=20write=20in=20the=20reuse=20test?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- bouncer_test.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bouncer_test.go b/bouncer_test.go index 7694f5c..0f1b1f3 100644 --- a/bouncer_test.go +++ b/bouncer_test.go @@ -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()