Skip to content

Conversation

sashass1315
Copy link
Contributor

Shadow loop variables i and test before t.Run in TestPack to prevent closure capture issues when running subtests with t.Parallel(). Without shadowing, all parallel subtests may read mutated loop variables, causing flaky and non-deterministic assertions. This change ensures each subtest operates on the correct iteration values. No functional logic changes; test stability only.

@MariusVanDerWijden
Copy link
Member

The copy of the 'for' variable "i" can be deleted (Go 1.22+) (copyloopvar)

This is not needed anymore after go 1.22. Since we only target the last two releases, this is unnecessary

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants