MCPcopy Create free account
hub / github.com/rabbitstack/fibratus / flatten

Method flatten

pkg/util/multierror/multierror.go:44–56  ·  view source on GitHub ↗

flatten returns either: nil, the only error, or the multiError instance itself if there are 0, 1, or more errors in the slice respectively.

()

Source from the content-addressed store, hash-verified

42// flatten returns either: nil, the only error, or the multiError instance itself
43// if there are 0, 1, or more errors in the slice respectively.
44func (errors multiError) flatten() error {
45 switch len(errors) {
46 case 0:
47 return nil
48 default:
49 for _, err := range errors {
50 if err != nil {
51 return errors
52 }
53 }
54 return nil
55 }
56}
57
58// Error returns a string like "[e1, e2, ...]" where each eN is the Error() of
59// each error in the slice.

Callers 2

WrapFunction · 0.80
WrapWithSeparatorFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected