1
0
mirror of https://github.com/duke-git/lancet.git synced 2026-02-04 12:52:28 +08:00

feat: complete promise Any function

This commit is contained in:
dudaodong
2023-03-16 15:59:06 +08:00
parent 3d8f1be212
commit 930bb9c839

View File

@@ -8,6 +8,8 @@ import (
"errors"
"fmt"
"sync"
"github.com/duke-git/lancet/v2/internal"
)
// Promise represents the eventual completion (or failure) of an asynchronous operation and its resulting value.
@@ -267,9 +269,10 @@ func Any[T any](promises ...*Promise[T]) *Promise[T] {
}
errCombo := errs[0]
// for _, err := range errs[1:] {
// errCombo = errors.
// }
for _, err := range errs[1:] {
errCombo = internal.JoinError(err)
}
reject(errCombo)
})
}