-
Notifications
You must be signed in to change notification settings - Fork 18k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
x/sync/errgroup: clarify that Go calls the function regardless of prior errors #54045
Comments
Since you are using a literal value for the type, check the documentation for the type itself.
Moreover, the documentation for the
It does not state any exception to that behavior if the group already has an error. We could perhaps clarify the documentation for the |
I see that now. I think it would be helpful to clarify that it's specifically the context that's cancelled, and you have to call ctx.Err manually. Thanks for explaining! |
@bcmills I'm happy to submit a PR fixing the docs if this issue is still valid to be fixed |
Change https://go.dev/cl/424634 mentions this issue: |
Even thought Go cancels the context in g, if it's not nil, it'll call any subsequent function, regardless if a previous call of f returned an error or not. Fixes golang/go#54045 Change-Id: Ie6059925f45458cf393bf1fc8949ce16be8e6f2a Reviewed-on: https://go-review.googlesource.com/c/sync/+/424634 TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Bryan Mills <bcmills@google.com> Run-TryBot: Bryan Mills <bcmills@google.com> Reviewed-by: Bryan Mills <bcmills@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What did you do?
What did you expect to see?
The documentation for errgroup states:
I would assume that if the first call to return a non-nil error cancels the group, future funcs passed to go won't run.
Furthermore calls to
group.Wait()
should return immediately rather than waiting for funcs created after the group was cancelled to complete.What did you see instead?
All funcs are called, even those created after the group was cancelled.
group.Wait()
waits for all funcs to complete before returning.The text was updated successfully, but these errors were encountered: