g, gCtx := errgroup.WithContext(ctx)
That would have avoided the problem.
Perhaps worth a submission to https://staticcheck.dev/ ?