aboutsummaryrefslogtreecommitdiff
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.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/vendor/github.com/hashicorp/go-multierror/format.go b/vendor/github.com/hashicorp/go-multierror/format.go
index bb65a12..6c7a3cc 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
// ListFormatFunc is a basic formatter that outputs the number of errors
// that occurred along with a bullet point list of the errors.
func ListFormatFunc(es []error) string {
+ if len(es) == 1 {
+ return fmt.Sprintf("1 error occurred:\n\n* %s", es[0])
+ }
+
points := make([]string, len(es))
for i, err := range es {
points[i] = fmt.Sprintf("* %s", err)
}
return fmt.Sprintf(
- "%d error(s) occurred:\n\n%s",
+ "%d errors occurred:\n\n%s",
len(es), strings.Join(points, "\n"))
}