WaitGroup is the primary building block for scoped concurrency. Goroutines can be spawned in the WaitGroup with the Go method, and calling Wait() will ensure that each of those goroutines exits before continuing. Any panics in a child goroutine will be caught and propagated to the caller of Wait().
| 20 | // The zero value of WaitGroup is usable, just like sync.WaitGroup. |
| 21 | // Also like sync.WaitGroup, it must not be copied after first use. |
| 22 | type WaitGroup struct { |
| 23 | wg sync.WaitGroup |
| 24 | pc panics.Catcher |
| 25 | } |
| 26 | |
| 27 | // Go spawns a new goroutine in the WaitGroup. |
| 28 | func (h *WaitGroup) Go(f func()) { |
nothing calls this directly
no outgoing calls
no test coverage detected