mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-10-19 05:39:51 +00:00
91774fc936
Uses github.com/libopenstorage/secrets to communicate with Vault. This removes the need for maintaining our own limited Vault APIs. By adding the new dependency, several other packages got updated in the process. Unused indirect dependencies have been removed from go.mod. Signed-off-by: Niels de Vos <ndevos@redhat.com>
28 lines
668 B
Go
28 lines
668 B
Go
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 {
|
|
if len(es) == 1 {
|
|
return fmt.Sprintf("1 error occurred:\n\t* %s\n\n", es[0])
|
|
}
|
|
|
|
points := make([]string, len(es))
|
|
for i, err := range es {
|
|
points[i] = fmt.Sprintf("* %s", err)
|
|
}
|
|
|
|
return fmt.Sprintf(
|
|
"%d errors occurred:\n\t%s\n\n",
|
|
len(es), strings.Join(points, "\n\t"))
|
|
}
|