diff options
Diffstat (limited to 'vendor/github.com/hashicorp/go-multierror/format.go')
-rw-r--r-- | vendor/github.com/hashicorp/go-multierror/format.go | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/vendor/github.com/hashicorp/go-multierror/format.go b/vendor/github.com/hashicorp/go-multierror/format.go new file mode 100644 index 0000000..bb65a12 --- /dev/null +++ b/vendor/github.com/hashicorp/go-multierror/format.go | |||
@@ -0,0 +1,23 @@ | |||
1 | package multierror | ||
2 | |||
3 | import ( | ||
4 | "fmt" | ||
5 | "strings" | ||
6 | ) | ||
7 | |||
8 | // ErrorFormatFunc is a function callback that is called by Error to | ||
9 | // turn the list of errors into a string. | ||
10 | type ErrorFormatFunc func([]error) string | ||
11 | |||
12 | // ListFormatFunc is a basic formatter that outputs the number of errors | ||
13 | // that occurred along with a bullet point list of the errors. | ||
14 | func ListFormatFunc(es []error) string { | ||
15 | points := make([]string, len(es)) | ||
16 | for i, err := range es { | ||
17 | points[i] = fmt.Sprintf("* %s", err) | ||
18 | } | ||
19 | |||
20 | return fmt.Sprintf( | ||
21 | "%d error(s) occurred:\n\n%s", | ||
22 | len(es), strings.Join(points, "\n")) | ||
23 | } | ||