✨ Refactor: Convert WaitErr to an interface and add New constructor
This commit is contained in:
parent
a68fc26481
commit
edc34062e9
4 changed files with 47 additions and 42 deletions
|
|
@ -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")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue