From 59284e4b4474cce9c818d002ace60f10e52aa64c Mon Sep 17 00:00:00 2001 From: itsabgr-raika Date: Tue, 8 Oct 2024 20:58:44 +0330 Subject: [PATCH] feat: implement interface { Unwrap() []error } for AggregateError to be compatibility with std errors.Join go1.20 without any breaking change (#336) Co-authored-by: abgr --- error.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/error.go b/error.go index a5c6ae43..2c8bfb55 100644 --- a/error.go +++ b/error.go @@ -40,6 +40,11 @@ func (e AggregateError) Error() string { return strings.TrimRight(sb.String(), ";") } +// Unwrap implements std errors.Join go1.20 compatibility +func (e AggregateError) Unwrap() []error { + return e.Errors +} + // Is conforms with errors.Is. func (e AggregateError) Is(err error) bool { for _, ie := range e.Errors {