🐛 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:
mhx
2026-09-03 09:08:17 +02:00
parent d7aa10477d
commit 7eedf65641
2 changed files with 14 additions and 17 deletions
+4 -1
View File
@@ -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)
}