Skip to content

Commit

Permalink
Fix linting errors in the errlist package
Browse files Browse the repository at this point in the history
References influxdata#4098
  • Loading branch information
wrrn committed Oct 5, 2018
1 parent 634f421 commit 216feed
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cmd/influx_tools/internal/errlist/errlist.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,28 @@ 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
}
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
}
return el
}

// Error satisfies the error interface.
func (el *ErrorList) Error() string {
var buf bytes.Buffer
for _, err := range el.errs {
Expand Down

0 comments on commit 216feed

Please sign in to comment.