Skip to content

refactor: use sync.WaitGroup.Go in tests#26671

Open
zedkipp wants to merge 1 commit into
mainfrom
zedkipp/wg-go-tests
Open

refactor: use sync.WaitGroup.Go in tests#26671
zedkipp wants to merge 1 commit into
mainfrom
zedkipp/wg-go-tests

Conversation

@zedkipp

@zedkipp zedkipp commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Migrate wg.Add(1); go func() { defer wg.Done(); ... }() to wg.Go(func() { ... }) in tests.

Where the prior pattern passed the loop variable explicitly via a closure parameter (go func(id int) { ... }(i)), drop the parameter and reference the loop variable directly. Per-iteration loop variables since Go 1.22 make this safe.

Migrate `wg.Add(1); go func() { defer wg.Done(); ... }()` to
`wg.Go(func() { ... })` in tests.

Where the prior pattern passed the loop variable explicitly via a
closure parameter (`go func(id int) { ... }(i)`), drop the parameter
and reference the loop variable directly. Per-iteration loop variables
since Go 1.22 make this safe.
@zedkipp zedkipp marked this pull request as ready for review June 24, 2026 21:35
@zedkipp zedkipp requested review from Emyrk and geokat June 24, 2026 21:39
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.

1 participant