Merge pull request #10336 from wrrn/error-golint

Fix linting errors in the errlist package
pull/9916/head^2
Edd Robinson 2019-02-01 07:58:05 -08:00 committed by GitHub
commit 4356c06a71
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -9,10 +9,12 @@ type ErrorList struct {
errs []error
}
// NewErrorList returns an empty *ErrorList
func NewErrorList() *ErrorList {
return &ErrorList{errs: make([]error, 0)}
}
// Add appends an error to the error list if the it not nil
func (el *ErrorList) Add(err error) {
if err == nil {
return
@ -20,6 +22,7 @@ func (el *ErrorList) Add(err error) {
el.errs = append(el.errs, err)
}
//Err returns whether or not an error list is an error.
func (el *ErrorList) Err() error {
if len(el.errs) == 0 {
return nil
@ -27,6 +30,7 @@ func (el *ErrorList) Err() error {
return el
}
// Error satisfies the error interface.
func (el *ErrorList) Error() string {
var buf bytes.Buffer
for _, err := range el.errs {