aboutsummaryrefslogtreecommitdiffhomepage
path: root/vendor/github.com/hashicorp/go-multierror/format.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/hashicorp/go-multierror/format.go')
-rw-r--r--vendor/github.com/hashicorp/go-multierror/format.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/vendor/github.com/hashicorp/go-multierror/format.go b/vendor/github.com/hashicorp/go-multierror/format.go
index bb65a12..47f13c4 100644
--- a/vendor/github.com/hashicorp/go-multierror/format.go
+++ b/vendor/github.com/hashicorp/go-multierror/format.go
@@ -12,12 +12,16 @@ type ErrorFormatFunc func([]error) string
12// ListFormatFunc is a basic formatter that outputs the number of errors 12// ListFormatFunc is a basic formatter that outputs the number of errors
13// that occurred along with a bullet point list of the errors. 13// that occurred along with a bullet point list of the errors.
14func ListFormatFunc(es []error) string { 14func ListFormatFunc(es []error) string {
15 if len(es) == 1 {
16 return fmt.Sprintf("1 error occurred:\n\t* %s\n\n", es[0])
17 }
18
15 points := make([]string, len(es)) 19 points := make([]string, len(es))
16 for i, err := range es { 20 for i, err := range es {
17 points[i] = fmt.Sprintf("* %s", err) 21 points[i] = fmt.Sprintf("* %s", err)
18 } 22 }
19 23
20 return fmt.Sprintf( 24 return fmt.Sprintf(
21 "%d error(s) occurred:\n\n%s", 25 "%d errors occurred:\n\t%s\n\n",
22 len(es), strings.Join(points, "\n")) 26 len(es), strings.Join(points, "\n\t"))
23} 27}