flatten returns either: nil, the only error, or the multiError instance itself if there are 0, 1, or more errors in the slice respectively.
()
| 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. |
| 44 | func (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. |
no outgoing calls
no test coverage detected