simplify error propagation

pull/432/merge
Darien Raymond 8 years ago
parent bf64c449de
commit 54b441d690
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169

@ -32,13 +32,13 @@ func ErrorOrFinish2(ctx context.Context, c1, c2 <-chan error) error {
select { select {
case <-ctx.Done(): case <-ctx.Done():
return ctx.Err() return ctx.Err()
case err, failed := <-c1: case err := <-c1:
if failed { if err != nil {
return err return err
} }
return ErrorOrFinish1(ctx, c2) return ErrorOrFinish1(ctx, c2)
case err, failed := <-c2: case err := <-c2:
if failed { if err != nil {
return err return err
} }
return ErrorOrFinish1(ctx, c1) return ErrorOrFinish1(ctx, c1)

Loading…
Cancel
Save