diff --git a/cmd/influx_tools/internal/errlist/errlist.go b/cmd/influx_tools/internal/errlist/errlist.go index fe96f99eae..23e8530333 100644 --- a/cmd/influx_tools/internal/errlist/errlist.go +++ b/cmd/influx_tools/internal/errlist/errlist.go @@ -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 {