-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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: Use WithCancelCause for errgroup.WithContext #59355
Milestone
Comments
Change https://go.dev/cl/481255 mentions this issue: |
peczenyj
added a commit
to peczenyj/cache
that referenced
this issue
Aug 4, 2023
…59355 - use WithCancelCause to cancel context
peczenyj
added a commit
to peczenyj/cache
that referenced
this issue
Aug 4, 2023
…59355 - use WithCancelCause to cancel context
Seems to have landed without a proposal acceptance but too late to do anything about that now. |
rsc
changed the title
proposal: x/sync: Use WithCancelCause for errgroup.WithContext
x/sync: Use WithCancelCause for errgroup.WithContext
Aug 9, 2023
anatoliinzrnk
added a commit
to anatoliinzrnk/go-sync
that referenced
this issue
Sep 25, 2024
Fixes golang/go#59355 Change-Id: Ib6a88e7e5fefe7b0d5672035af16d109aabcbf1e Reviewed-on: https://go-review.googlesource.com/c/sync/+/481255 TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Bryan Mills <bcmills@google.com> Reviewed-by: Bryan Mills <bcmills@google.com> Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Michael Knyszek <mknyszek@google.com> Auto-Submit: Bryan Mills <bcmills@google.com>
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
When using
errgroup.WithContext
, the first non-nil error encountered will cancel the context and then be returned by the next call toWait
. This works well when you actually callWait
, but if that canceled context prevents you from callingWait
, you just get an unhelpfulcontext canceled
error.I believe the new
context.WithCancelCause
added in 1.20 would fix this, so I propose we use that instead of thiscontext.WithCancel
so we can propagate the error here, here, and here.The text was updated successfully, but these errors were encountered: