Files
fasthttp/fasthttputil
Y.Horie 0643f42190 ci: re-enable gocritic deferInLoop check (#2288)
deferInLoop was disabled in .golangci.yml, so CI could not catch defer
statements added inside for loops. Such defers run only at function exit,
not per iteration, leaking file descriptors, connections, or locks under
load.

Re-enable the check and fix the two existing occurrences in test code
instead of excluding test files:

- inmemory listener test: deferred conn.Close() inside the accept loop;
  move the per-connection handling into a closure so each connection is
  closed when done.
- TestClientManyServers: every server must stay up until the test ends,
  so hoist the defer out of the loop and stop all servers in a single
  deferred loop.

Fixes #2233

Signed-off-by: Y.Horie <u5.horie@gmail.com>
2026-06-13 05:49:39 +02:00
..