Merge pull request #10336 from wrrn/error-golint
Fix linting errors in the errlist packagepull/9916/head^2
commit
4356c06a71
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue