From c6e6d743694e9ea5d7d56d906396f01e5989a9dd Mon Sep 17 00:00:00 2001 From: Camden Cheek Date: Mon, 8 Jan 2024 11:12:58 -0700 Subject: [PATCH] join error slice --- iter/map.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/iter/map.go b/iter/map.go index b311287..c5462c0 100644 --- a/iter/map.go +++ b/iter/map.go @@ -49,16 +49,16 @@ func (m Mapper[T, R]) MapErr(input []T, f func(*T) (R, error)) ([]R, error) { var ( res = make([]R, len(input)) errMux sync.Mutex - errs error + errs []error ) Iterator[T](m).ForEachIdx(input, func(i int, t *T) { var err error res[i], err = f(t) if err != nil { errMux.Lock() - errs = multierror.Join(errs, err) + errs = append(errs, err) errMux.Unlock() } }) - return res, errs + return res, multierror.Join(errs...) }