Thanks for your response.
Got it.
On Wed, 27 May, 2020, 6:22 PM Tamás Gulácsi, wrote:
> errgroup does not terminate.
> But will signal the (sub)context returned by WithContext when any
> goroutine returns with an error.
>
> So if your functions handle the context cancelation by exiting, then you
errgroup does not terminate.
But will signal the (sub)context returned by WithContext when any goroutine
returns with an error.
So if your functions handle the context cancelation by exiting, then you can
cancel other goroutines.
I asvice using such sub context with requests, too.
--
You rece
Code from https://pkg.go.dev/golang.org/x/sync/errgroup?tab=doc
var g errgroup.Group
var urls = []string{
"http://www.golang.org/";,
"http://www.google.com/";,
"http://www.somestupidname.com/";,
}
for _, url := range urls {
url := url
g.Go(func() error {