MultiErrorFormat specifies the formatter applied to format multierrors. Deprecated: Please use [errors.Join] instead.
(es []error)
| 108 | // |
| 109 | // Deprecated: Please use [errors.Join] instead. |
| 110 | func MultiErrorFormat(es []error) string { |
| 111 | if len(es) == 1 { |
| 112 | return es[0].Error() |
| 113 | } |
| 114 | |
| 115 | points := make([]string, len(es)) |
| 116 | for i, err := range es { |
| 117 | points[i] = fmt.Sprintf("* %s", err) |
| 118 | } |
| 119 | |
| 120 | return fmt.Sprintf( |
| 121 | "%d errors occurred:\n\t%s\n", |
| 122 | len(es), strings.Join(points, "\n\t")) |
| 123 | } |
| 124 | |
| 125 | type sentinelError struct { |
| 126 | sentinel error |