Refactor: Convert WaitErr to an interface and add New constructor

This commit is contained in:
Dan Jones 2025-11-14 14:04:51 -06:00
commit edc34062e9
4 changed files with 47 additions and 42 deletions

View file

@ -33,7 +33,7 @@ import (
)
func main() {
we := new(waiterr.WaitErr)
we := waiterr.New()
we.Go(func() error {
time.Sleep(100 * time.Millisecond)
@ -60,7 +60,7 @@ func main() {
}
// You can also get the first error immediately
we2 := new(waiterr.WaitErr)
we2 := waiterr.New()
we2.Go(func() error {
time.Sleep(100 * time.Millisecond)
return errors.New("first error from we2")