util: Port all multierr code to new errwrap package

This cleans things up and simplifies a lot of the code. Also it's easier
to just import one error package when needed.
This commit is contained in:
James Shubin
2019-03-12 16:51:37 -04:00
parent 880652f5d4
commit 753d1104ef
21 changed files with 83 additions and 146 deletions

View File

@@ -25,8 +25,7 @@ import (
"time"
"github.com/purpleidea/mgmt/util"
multierr "github.com/hashicorp/go-multierror"
"github.com/purpleidea/mgmt/util/errwrap"
)
// New builds a new converger coordinator.
@@ -323,9 +322,8 @@ func (obj *Coordinator) runStateFns(converged bool) error {
for _, name := range keys { // run in deterministic order
fn := obj.stateFns[name]
// call an arbitrary function
if e := fn(converged); e != nil {
err = multierr.Append(err, e) // list of errors
}
e := fn(converged)
err = errwrap.Append(err, e) // list of errors
}
return err
}