mirror of
https://github.com/maxlerebourg/crowdsec-bouncer-traefik-plugin.git
synced 2026-09-04 21:18:52 +02:00
🐛 avoid range-over-int so yaegi can parse the test
make yaegi_test pins yaegi v0.16.1, the version Traefik bundles, and it cannot parse Go 1.22 range-over-int: it panics with "nil type" in scope.go. Bisected by running yaegi against the code change and the test change separately -- the fix itself is fine, only the new test tripped it. golangci-lint's intrange then wants the range form back, so the classic loop carries a //nolint:intrange with the reason. Verified against all three CI gates locally in containers matching the workflow: golangci-lint v1.63.4, yaegi v0.16.1 under GOPATH, and go test on go1.22.
This commit is contained in:
+4
-1
@@ -593,7 +593,10 @@ func Test_appsecQuery_reusesConnection(t *testing.T) {
|
||||
}
|
||||
|
||||
const calls = 10
|
||||
for range calls {
|
||||
// Not a range-over-int loop: yaegi v0.16.1, which is what Traefik
|
||||
// bundles and what `make yaegi_test` pins, cannot parse that form
|
||||
// and panics with "nil type".
|
||||
for i := 0; i < calls; i++ { //nolint:intrange
|
||||
req, _ := http.NewRequest(http.MethodGet, "http://localhost/", nil)
|
||||
_ = appsecQuery(bouncer, "1.2.3.4", req)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user