February 2018
Intermediate to advanced
340 pages
9h 43m
English
The golang.org/x/sync/errgroup package helps to simplify the error propagation and cancellation by context for goroutine groups. The Group contains the Go method which consumes the no-arg function returning the error. This function should contain the task which should be done by the executed goroutine. The Wait method of the Group from errgroup waits until all executed tasks from the Go method are complete, and if any of them are returned err, then the first non-nil error is returned. This way, it is possible to simply propagate the error from the group of running goroutines.
Read now
Unlock full access