go-pkgz / syncs

Concurrency and synchronization primitives
https://go-pkgz.umputun.dev/syncs/
MIT License
136 stars 13 forks source link

Fix nil error checks #1

Closed romannekhor closed 5 years ago

romannekhor commented 5 years ago

Hi @umputun,

I just found a small bug in ErrSizedGroup Wait() function.

The code below will always fail:

    grp := NewErrSizedGroup(10)

    // wait for completion
    if err := grp.Wait(); err != nil {
        panic(err)
    }

The fix is very simple: before: func (m *multierror) errorOrNil() *multierror { after: func (m *multierror) errorOrNil() error {

More details: https://dev.to/pauljlucas/go-tcha-when-nil--nil-hic ("nil != nil" in Go)

umputun commented 5 years ago

thx