Skip to content

x/sync: Use WithCancelCause for errgroup.WithContext #59355

Closed
@jonjohnsonjr

Description

@jonjohnsonjr

When using errgroup.WithContext, the first non-nil error encountered will cancel the context and then be returned by the next call to Wait. This works well when you actually call Wait, but if that canceled context prevents you from calling Wait, you just get an unhelpful context canceled error.

I believe the new context.WithCancelCause added in 1.20 would fix this, so I propose we use that instead of this context.WithCancel so we can propagate the error here, here, and here.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions