Commit 1a45e58d
1a45e58d0ba2Merged
Svyatoslav <[email protected]> ยท 5 years ago ยท 2 files ยท ~2 modified
Description
Some fixes
Details
- Commit
- 1a45e58d0ba2
- Parent
- 41a19d3f20ae
pkg/parallel/parallel.gomodifiedView file
@@ -8,6 +8,7 @@
88
type WaitGroup struct {99
syncWG *sync.WaitGroup1010
errChan chan error11+
err *multierror.Error1112
}1213
1314
func (wg *WaitGroup) ErrChan() chan<- error {@@ -18,21 +19,24 @@
1819
return &WaitGroup{1920
syncWG: &sync.WaitGroup{},2021
errChan: make(chan error),22+
err: &multierror.Error{},2123
}2224
}23-
24-
func (wg *WaitGroup) Wait() error {25-
wg.syncWG.Wait()2625
27-
result := &multierror.Error{}28-
26+
func (wg *WaitGroup) gatherErrors() {2927
for err := range wg.errChan {3028
if err != nil {31-
result = multierror.Append(result, err)29+
wg.err = multierror.Append(wg.err, err)3230
}3331
}32+
}3433
35-
return result.ErrorOrNil()34+
func (wg *WaitGroup) Wait() error {35+
go wg.gatherErrors()36+
wg.syncWG.Wait()37+
close(wg.errChan)38+
39+
return wg.err.ErrorOrNil()3640
}3741
3842
func (wg *WaitGroup) Add(i int) {pkg/yml/sync.gomodifiedView file
Loading diffโฆ