From cd77a1e85315bec8f1a5444543b03fac50dfd363 Mon Sep 17 00:00:00 2001 From: Dhruba Basu <7675102+dhrubabasu@users.noreply.github.com> Date: Wed, 25 Oct 2023 13:27:43 -0400 Subject: [PATCH] Remove `aggregate` struct (#2213) --- utils/wrappers/errors.go | 29 ----------------------------- 1 file changed, 29 deletions(-) diff --git a/utils/wrappers/errors.go b/utils/wrappers/errors.go index 1f0f19846ffe..641734da16c0 100644 --- a/utils/wrappers/errors.go +++ b/utils/wrappers/errors.go @@ -3,10 +3,6 @@ package wrappers -import "strings" - -var _ error = (*aggregate)(nil) - type Errs struct{ Err error } func (errs *Errs) Errored() bool { @@ -23,28 +19,3 @@ func (errs *Errs) Add(errors ...error) { } } } - -// NewAggregate returns an aggregate error from a list of errors -func NewAggregate(errs []error) error { - err := &aggregate{errs} - if len(err.Errors()) == 0 { - return nil - } - return err -} - -type aggregate struct{ errs []error } - -// Error returns the slice of errors with comma separated messsages wrapped in brackets -// [ error string 0 ], [ error string 1 ] ... -func (a *aggregate) Error() string { - errString := make([]string, len(a.errs)) - for i, err := range a.errs { - errString[i] = "[" + err.Error() + "]" - } - return strings.Join(errString, ",") -} - -func (a *aggregate) Errors() []error { - return a.errs -}