Comment on A subtle bug with Go's errgroupComments−nickcw1yI love errgroup, though I always use it like this g, gCtx := errgroup.WithContext(ctx) And then use gCtx in the g.Go function calls.That would have avoided the problem.Perhaps worth a submission to https://staticcheck.dev/ ?−nikolayasdf1231yI just made very simpler linter for this: https://github.com/nikolaydubina/lint-errgroup-ctx
Comments
I love errgroup, though I always use it like this
And then use gCtx in the g.Go function calls.That would have avoided the problem.
Perhaps worth a submission to https://staticcheck.dev/ ?
I just made very simpler linter for this: https://github.com/nikolaydubina/lint-errgroup-ctx