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.go23
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 @@
+package multierror
+
+import (
+ "fmt"
+ "strings"
+)
+
+// ErrorFormatFunc is a function callback that is called by Error to
+// turn the list of errors into a string.
+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 {
+ 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",
+ len(es), strings.Join(points, "\n"))
+}