]> git.immae.eu Git - github/fretlink/terraform-provider-statuscake.git/blobdiff - vendor/github.com/hashicorp/go-multierror/format.go
Initial transfer of provider code
[github/fretlink/terraform-provider-statuscake.git] / vendor / github.com / hashicorp / go-multierror / format.go
diff --git a/vendor/github.com/hashicorp/go-multierror/format.go b/vendor/github.com/hashicorp/go-multierror/format.go
new file mode 100644 (file)
index 0000000..bb65a12
--- /dev/null
@@ -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"))
+}