type Group
Group是一组处理子任务的goroutines的集合,这些子任务是同一个整体任务的一部分。
// 零值是有效的,不会在出错时取消。
type Group struct {
// contains filtered or unexported fields
}
// WithContext返回一个新的Group和一个从ctx派生出来的关联Context。
// 当传递给Go的函数第一次返回非空错误或Wait第一次返回时,派生的Context会被取消,以先发生的为准。
func WithContext(ctx context.Context) (*Group, context.Context)
func (g *Group) Go(f func() error)
func (g *Group) Wait() error