Kuldeep Singh
Oct 4, 2024

--

Yes thanks for highlighting it.

The normal errgroup.Group does not stop the running goroutines and only returns the first error occured, other are lost.

But if you wants other processes to close and no new goroutine then you might need to use the context

var errGroup, ctx = errgroup.WithContext(context.Background())

this will make sure that as soon as an error occurs in any goroutine, the errgroup cancels all other goroutines.

--

--

Kuldeep Singh
Kuldeep Singh

No responses yet