error, len(requests)) var wg sync.WaitGroup wg.Add(len(requests)) for _, req := range requests { go func(req string) { if err = send(ctx, req); err != nil { errCh <- err } wg.Done() }(req) } wg.Wait() close(errCh) return <-errCh } Dave Cheney: Concurrency made easy