📝 Update comments in waiterr.go

This commit is contained in:
Dan Jones 2025-11-13 15:37:23 -06:00
commit d49f548618

View file

@ -5,7 +5,7 @@ import (
"sync"
)
// WaitErr wraps a sync.WaitGroup with error handling.
// WaitErr wraps a [sync.WaitGroup] with error handling.
type WaitErr struct {
wg sync.WaitGroup
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
// with we.Wait().
// with [WaitErr.Wait].
func (we *WaitErr) Go(f func() error) {
we.initErrChOnce.Do(func() {
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.
// 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 {
errs := make([]error, 0, len(we.errs))
for _, e := range we.errs {