You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Once a goroutine is ready to run (no longer blocked), errgroup should check if the context has already been cancelled (e.g. the errgroup was created with WithContext and a previous step returned an error). If it has, the next step should not be run.
I guess we would have to check g.cancel != nil to check if the errgroup was created with WithContext to preserve the existing behavior: if not using WithContext, all goroutines should be completed regardless of errors being returned.
This change might be problematic, because it would mean that calling Go does not guarantee that the function will run. Might have to return a bool or error from the Go func.
Once a goroutine is ready to run (no longer blocked), errgroup should check if the context has already been cancelled (e.g. the errgroup was created with
WithContext
and a previous step returned anerror
). If it has, the next step should not be run.I guess we would have to check
g.cancel != nil
to check if the errgroup was created withWithContext
to preserve the existing behavior: if not usingWithContext
, all goroutines should be completed regardless oferror
s being returned.(*Group) Go
Add this
here
https://github.com/golang/sync/blob/93782cc822b6b554cb7df40332fd010f0473cbc8/errgroup/errgroup.go#L70
This change might be problematic, because it would mean that calling
Go
does not guarantee that the function will run. Might have to return abool
orerror
from theGo
func.(*Group) TryGo
Add this
here
https://github.com/golang/sync/blob/93782cc822b6b554cb7df40332fd010f0473cbc8/errgroup/errgroup.go#L99
Workaround
I can achieve this behavior today like this, but it feels like something that should be included.
The text was updated successfully, but these errors were encountered: