type MessageCountMap … type Aggregate … // NewAggregate converts a slice of errors into an Aggregate interface, which // is itself an implementation of the error interface. If the slice is empty, // this returns nil. // It will check if any of the element of input error list is nil, to avoid // nil pointer panic when call Error(). func NewAggregate(errlist []error) Aggregate { … } type aggregate … // Error is part of the error interface. func (agg aggregate) Error() string { … } func (agg aggregate) Is(target error) bool { … } func (agg aggregate) visit(f func(err error) bool) bool { … } // Errors is part of the Aggregate interface. func (agg aggregate) Errors() []error { … } type Matcher … // FilterOut removes all errors that match any of the matchers from the input // error. If the input is a singular error, only that error is tested. If the // input implements the Aggregate interface, the list of errors will be // processed recursively. // // This can be used, for example, to remove known-OK errors (such as io.EOF or // os.PathNotFound) from a list of errors. func FilterOut(err error, fns ...Matcher) error { … } // matchesError returns true if any Matcher returns true func matchesError(err error, fns ...Matcher) bool { … } // filterErrors returns any errors (or nested errors, if the list contains // nested Errors) for which all fns return false. If no errors // remain a nil list is returned. The resulting silec will have all // nested slices flattened as a side effect. func filterErrors(list []error, fns ...Matcher) []error { … } // Flatten takes an Aggregate, which may hold other Aggregates in arbitrary // nesting, and flattens them all into a single Aggregate, recursively. func Flatten(agg Aggregate) Aggregate { … } // CreateAggregateFromMessageCountMap converts MessageCountMap Aggregate func CreateAggregateFromMessageCountMap(m MessageCountMap) Aggregate { … } // Reduce will return err or, if err is an Aggregate and only has one item, // the first item in the aggregate. func Reduce(err error) error { … } // AggregateGoroutines runs the provided functions in parallel, stuffing all // non-nil errors into the returned Aggregate. // Returns nil if all the functions complete successfully. func AggregateGoroutines(funcs ...func() error) Aggregate { … } var ErrPreconditionViolated …