newMultiError returns a *MultiError if there is more than one error, or returns that error directly when there is only one. Passing an empty slice will return nil (because there is no error). The importPath may be passed if this error is for a single package.
(errs []error, importPath string)
| 18 | // will return nil (because there is no error). |
| 19 | // The importPath may be passed if this error is for a single package. |
| 20 | func newMultiError(errs []error, importPath string) error { |
| 21 | switch len(errs) { |
| 22 | case 0: |
| 23 | return nil |
| 24 | case 1: |
| 25 | return errs[0] |
| 26 | default: |
| 27 | return &MultiError{importPath, errs} |
| 28 | } |
| 29 | } |
| 30 | |
| 31 | // commandError is an error type to wrap os/exec.Command errors. This provides |
| 32 | // some more information regarding what went wrong while running a command. |
no outgoing calls
no test coverage detected