📝 Update comments in waiterr.go
This commit is contained in:
parent
25b10a1896
commit
d49f548618
1 changed files with 3 additions and 3 deletions
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"sync"
|
"sync"
|
||||||
)
|
)
|
||||||
|
|
||||||
// WaitErr wraps a sync.WaitGroup with error handling.
|
// WaitErr wraps a [sync.WaitGroup] with error handling.
|
||||||
type WaitErr struct {
|
type WaitErr struct {
|
||||||
wg sync.WaitGroup
|
wg sync.WaitGroup
|
||||||
errs []error
|
errs []error
|
||||||
|
|
@ -17,7 +17,7 @@ type WaitErr struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Go runs f in its own goroutine. When f returns, its error is stored, and returned
|
// Go runs f in its own goroutine. When f returns, its error is stored, and returned
|
||||||
// with we.Wait().
|
// with [WaitErr.Wait].
|
||||||
func (we *WaitErr) Go(f func() error) {
|
func (we *WaitErr) Go(f func() error) {
|
||||||
we.initErrChOnce.Do(func() {
|
we.initErrChOnce.Do(func() {
|
||||||
we.errCh = make(chan error, 1)
|
we.errCh = make(chan error, 1)
|
||||||
|
|
@ -90,7 +90,7 @@ func (we *WaitErr) Wait() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Unwrap returns all non-nil errors returned by our functions.
|
// Unwrap returns all non-nil errors returned by our functions.
|
||||||
// If we.errs is empty, or all errors are nil, just return nil.
|
// If no errors were returned, or all errors are nil, it returns nil.
|
||||||
func (we *WaitErr) Unwrap() []error {
|
func (we *WaitErr) Unwrap() []error {
|
||||||
errs := make([]error, 0, len(we.errs))
|
errs := make([]error, 0, len(we.errs))
|
||||||
for _, e := range we.errs {
|
for _, e := range we.errs {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue