diff --git a/eventloop.go b/eventloop.go index cfd42d8..7177195 100644 --- a/eventloop.go +++ b/eventloop.go @@ -5,7 +5,6 @@ import ( "errors" "os" - "github.com/hashicorp/go-multierror" "github.com/wagoodman/go-partybus" "github.com/anchore/go-logger" @@ -38,7 +37,7 @@ func eventloop(ctx context.Context, log logger.Logger, subscription *partybus.Su break } - var retErr error + var retErr []error var forceTeardown bool for { @@ -54,7 +53,7 @@ func eventloop(ctx context.Context, log logger.Logger, subscription *partybus.Su } if err != nil { // capture the error from the worker and unsubscribe to complete a graceful shutdown - retErr = multierror.Append(retErr, err) + retErr = append(retErr, err) if subscription != nil { _ = subscription.Unsubscribe() } @@ -102,7 +101,7 @@ func eventloop(ctx context.Context, log logger.Logger, subscription *partybus.Su if errors.Is(err, partybus.ErrUnsubscribe) { events = nil } else { - retErr = multierror.Append(retErr, err) + retErr = append(retErr, err) // TODO: should we unsubscribe? should we try to halt execution? or continue? } } @@ -123,9 +122,9 @@ func eventloop(ctx context.Context, log logger.Logger, subscription *partybus.Su } if ux != nil { if err := ux.Teardown(forceTeardown); err != nil { - retErr = multierror.Append(retErr, err) + retErr = append(retErr, err) } } - return retErr + return errors.Join(retErr...) } diff --git a/go.mod b/go.mod index 713c6e4..ec994e5 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,6 @@ require ( github.com/anchore/fangs v0.0.0-20230807173929-13c94c86f47e github.com/anchore/go-logger v0.0.0-20230725134548-c21dafa1ec5a github.com/gookit/color v1.5.4 - github.com/hashicorp/go-multierror v1.1.1 github.com/iancoleman/strcase v0.3.0 github.com/pborman/indent v1.2.1 github.com/pkg/profile v1.7.0 @@ -26,7 +25,6 @@ require ( github.com/fsnotify/fsnotify v1.6.0 // indirect github.com/google/pprof v0.0.0-20211214055906-6f57359322fd // indirect github.com/google/uuid v1.3.0 // indirect - github.com/hashicorp/errwrap v1.0.0 // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/magiconair/properties v1.8.7 // indirect diff --git a/go.sum b/go.sum index ebc89a0..d3af217 100644 --- a/go.sum +++ b/go.sum @@ -133,10 +133,6 @@ github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5m github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g= github.com/gookit/color v1.5.4 h1:FZmqs7XOyGgCAxmWyPslpiok1k05wmY3SJTytgvYFs0= github.com/gookit/color v1.5.4/go.mod h1:pZJOeOS8DM43rXbp4AZo1n9zCU2qjpcRko0b6/QJi9w= -github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA= -github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= -github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= -github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=