3 ms·
> Increasing the channel size to 2 is the correct fix. Or is the correct fix to use errgroup[1]? func doSomethingTwice() error { var g errgroup.Group
by randomdata 8y ago
> Increasing the channel size to 2 is the correct fix.
Or is the correct fix to use errgroup[1]?
func doSomethingTwice() error {
var g errgroup.Group
g.Go(func() error {
defer fmt.Println("done wth a")
return doSomething("a")
})
g.Go(func() error {
defer fmt.Println("done with b")
return doSomething("b")
})
return g.Wait()
}
[1] https://godoc.org/golang.org/x/sync/errgroup https://godoc.org/golang.org/x/sync/errgroup