Skip to content

Commit

Permalink
feat!: replace WrappedErrors with Unwrap
Browse files Browse the repository at this point in the history
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
  • Loading branch information
sagikazarmark committed Jun 2, 2024
1 parent b94b0f8 commit 44474a2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions error.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,8 @@ func (e *joinedError) Error() string {
len(e.Errors), strings.Join(points, "\n"))
}

// WrappedErrors implements the errwrap.Wrapper interface to make this
// return value more useful with the errwrap and go-multierror libraries.
func (e *joinedError) WrappedErrors() []error {
// Unwrap implements the Unwrap function added in Go 1.20.
func (e *joinedError) Unwrap() []error {
if e == nil {
return nil
}
Expand All @@ -40,6 +39,7 @@ func (e *joinedError) WrappedErrors() []error {
return result
}

// TODO: replace with errors.Join when Go 1.20 is minimum version.
func appendErrors(errors []string, err error) []string {
switch e := err.(type) {
case *joinedError:
Expand Down

0 comments on commit 44474a2

Please sign in to comment.