diff options
Diffstat (limited to 'vendor/github.com/hashicorp/go-multierror')
9 files changed, 86 insertions, 6 deletions
diff --git a/vendor/github.com/hashicorp/go-multierror/.travis.yml b/vendor/github.com/hashicorp/go-multierror/.travis.yml new file mode 100644 index 0000000..304a835 --- /dev/null +++ b/vendor/github.com/hashicorp/go-multierror/.travis.yml | |||
@@ -0,0 +1,12 @@ | |||
1 | sudo: false | ||
2 | |||
3 | language: go | ||
4 | |||
5 | go: | ||
6 | - 1.x | ||
7 | |||
8 | branches: | ||
9 | only: | ||
10 | - master | ||
11 | |||
12 | script: make test testrace | ||
diff --git a/vendor/github.com/hashicorp/go-multierror/Makefile b/vendor/github.com/hashicorp/go-multierror/Makefile new file mode 100644 index 0000000..b97cd6e --- /dev/null +++ b/vendor/github.com/hashicorp/go-multierror/Makefile | |||
@@ -0,0 +1,31 @@ | |||
1 | TEST?=./... | ||
2 | |||
3 | default: test | ||
4 | |||
5 | # test runs the test suite and vets the code. | ||
6 | test: generate | ||
7 | @echo "==> Running tests..." | ||
8 | @go list $(TEST) \ | ||
9 | | grep -v "/vendor/" \ | ||
10 | | xargs -n1 go test -timeout=60s -parallel=10 ${TESTARGS} | ||
11 | |||
12 | # testrace runs the race checker | ||
13 | testrace: generate | ||
14 | @echo "==> Running tests (race)..." | ||
15 | @go list $(TEST) \ | ||
16 | | grep -v "/vendor/" \ | ||
17 | | xargs -n1 go test -timeout=60s -race ${TESTARGS} | ||
18 | |||
19 | # updatedeps installs all the dependencies needed to run and build. | ||
20 | updatedeps: | ||
21 | @sh -c "'${CURDIR}/scripts/deps.sh' '${NAME}'" | ||
22 | |||
23 | # generate runs `go generate` to build the dynamically generated source files. | ||
24 | generate: | ||
25 | @echo "==> Generating..." | ||
26 | @find . -type f -name '.DS_Store' -delete | ||
27 | @go list ./... \ | ||
28 | | grep -v "/vendor/" \ | ||
29 | | xargs -n1 go generate | ||
30 | |||
31 | .PHONY: default test testrace updatedeps generate | ||
diff --git a/vendor/github.com/hashicorp/go-multierror/README.md b/vendor/github.com/hashicorp/go-multierror/README.md index e81be50..ead5830 100644 --- a/vendor/github.com/hashicorp/go-multierror/README.md +++ b/vendor/github.com/hashicorp/go-multierror/README.md | |||
@@ -1,5 +1,11 @@ | |||
1 | # go-multierror | 1 | # go-multierror |
2 | 2 | ||
3 | [![Build Status](http://img.shields.io/travis/hashicorp/go-multierror.svg?style=flat-square)][travis] | ||
4 | [![Go Documentation](http://img.shields.io/badge/go-documentation-blue.svg?style=flat-square)][godocs] | ||
5 | |||
6 | [travis]: https://travis-ci.org/hashicorp/go-multierror | ||
7 | [godocs]: https://godoc.org/github.com/hashicorp/go-multierror | ||
8 | |||
3 | `go-multierror` is a package for Go that provides a mechanism for | 9 | `go-multierror` is a package for Go that provides a mechanism for |
4 | representing a list of `error` values as a single `error`. | 10 | representing a list of `error` values as a single `error`. |
5 | 11 | ||
diff --git a/vendor/github.com/hashicorp/go-multierror/append.go b/vendor/github.com/hashicorp/go-multierror/append.go index 00afa9b..775b6e7 100644 --- a/vendor/github.com/hashicorp/go-multierror/append.go +++ b/vendor/github.com/hashicorp/go-multierror/append.go | |||
@@ -18,9 +18,13 @@ func Append(err error, errs ...error) *Error { | |||
18 | for _, e := range errs { | 18 | for _, e := range errs { |
19 | switch e := e.(type) { | 19 | switch e := e.(type) { |
20 | case *Error: | 20 | case *Error: |
21 | err.Errors = append(err.Errors, e.Errors...) | 21 | if e != nil { |
22 | err.Errors = append(err.Errors, e.Errors...) | ||
23 | } | ||
22 | default: | 24 | default: |
23 | err.Errors = append(err.Errors, e) | 25 | if e != nil { |
26 | err.Errors = append(err.Errors, e) | ||
27 | } | ||
24 | } | 28 | } |
25 | } | 29 | } |
26 | 30 | ||
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. |
14 | func ListFormatFunc(es []error) string { | 14 | func 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 | } |
diff --git a/vendor/github.com/hashicorp/go-multierror/go.mod b/vendor/github.com/hashicorp/go-multierror/go.mod new file mode 100644 index 0000000..2534331 --- /dev/null +++ b/vendor/github.com/hashicorp/go-multierror/go.mod | |||
@@ -0,0 +1,3 @@ | |||
1 | module github.com/hashicorp/go-multierror | ||
2 | |||
3 | require github.com/hashicorp/errwrap v1.0.0 | ||
diff --git a/vendor/github.com/hashicorp/go-multierror/go.sum b/vendor/github.com/hashicorp/go-multierror/go.sum new file mode 100644 index 0000000..85b1f8f --- /dev/null +++ b/vendor/github.com/hashicorp/go-multierror/go.sum | |||
@@ -0,0 +1,4 @@ | |||
1 | github.com/hashicorp/errwrap v0.0.0-20141028054710-7554cd9344ce h1:prjrVgOk2Yg6w+PflHoszQNLTUh4kaByUcEWM/9uin4= | ||
2 | github.com/hashicorp/errwrap v0.0.0-20141028054710-7554cd9344ce/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= | ||
3 | github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA= | ||
4 | github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= | ||
diff --git a/vendor/github.com/hashicorp/go-multierror/multierror.go b/vendor/github.com/hashicorp/go-multierror/multierror.go index 2ea0827..89b1422 100644 --- a/vendor/github.com/hashicorp/go-multierror/multierror.go +++ b/vendor/github.com/hashicorp/go-multierror/multierror.go | |||
@@ -40,11 +40,11 @@ func (e *Error) GoString() string { | |||
40 | } | 40 | } |
41 | 41 | ||
42 | // WrappedErrors returns the list of errors that this Error is wrapping. | 42 | // WrappedErrors returns the list of errors that this Error is wrapping. |
43 | // It is an implementatin of the errwrap.Wrapper interface so that | 43 | // It is an implementation of the errwrap.Wrapper interface so that |
44 | // multierror.Error can be used with that library. | 44 | // multierror.Error can be used with that library. |
45 | // | 45 | // |
46 | // This method is not safe to be called concurrently and is no different | 46 | // This method is not safe to be called concurrently and is no different |
47 | // than accessing the Errors field directly. It is implementd only to | 47 | // than accessing the Errors field directly. It is implemented only to |
48 | // satisfy the errwrap.Wrapper interface. | 48 | // satisfy the errwrap.Wrapper interface. |
49 | func (e *Error) WrappedErrors() []error { | 49 | func (e *Error) WrappedErrors() []error { |
50 | return e.Errors | 50 | return e.Errors |
diff --git a/vendor/github.com/hashicorp/go-multierror/sort.go b/vendor/github.com/hashicorp/go-multierror/sort.go new file mode 100644 index 0000000..fecb14e --- /dev/null +++ b/vendor/github.com/hashicorp/go-multierror/sort.go | |||
@@ -0,0 +1,16 @@ | |||
1 | package multierror | ||
2 | |||
3 | // Len implements sort.Interface function for length | ||
4 | func (err Error) Len() int { | ||
5 | return len(err.Errors) | ||
6 | } | ||
7 | |||
8 | // Swap implements sort.Interface function for swapping elements | ||
9 | func (err Error) Swap(i, j int) { | ||
10 | err.Errors[i], err.Errors[j] = err.Errors[j], err.Errors[i] | ||
11 | } | ||
12 | |||
13 | // Less implements sort.Interface function for determining order | ||
14 | func (err Error) Less(i, j int) bool { | ||
15 | return err.Errors[i].Error() < err.Errors[j].Error() | ||
16 | } | ||