// ParallelIntCancelOnError runs the given functions in parallel, cancelling all if one fails.
//
// It collects all the errors and results (regardless if there were errors or not). To obtain
// the multiple errors, use the `Errors` function.
ParallelIntCancelOnError runs the given functions in parallel, cancelling all if one fails.

It collects all the errors and results (regardless if there were errors or not). To obtain
the multiple errors, use the `Errors` function.
// ParallelIntCancelOnError runs the given functions in parallel cancelling all if one fails . // // It collects all the errors and results ( regardless if there were errors or not ) . To obtain // the multiple errors use the ` Errors ` function .
func (f *Flow) ParallelIntCancelOnError(ctx context.Context, fns ...IntFunc) ([]int, error) {
	if len(fns) == 0 {
		return nil, nil
	}
	ctx, cancel := context.WithCancel(ctx)
	defer cancel()
	c := make(chan intResult)
	f.runAll(len(fns), func(i int) {
		item, err := fns[i](ctx)
		c <- intResult{item, err}
	}, func() { close(c) })
	var (
		out  []int
		errs multiError
	)
	for res := range c {
		if res.err != nil {
			cancel()
			errs = append(errs, res.err)
			continue
		}
		out = append(out, res.item)
	}
	return out, errs.ErrorOrNil()
}
func ( f * Flow ) ParallelIntCancelOnError ( ctx context . Context , fns ... IntFunc ) ( [ ] int , error ) { if len ( fns ) == 0 { return nil , nil } ctx , cancel := context . WithCancel ( ctx ) defer cancel ( ) c := make ( chan intResult ) f . runAll ( len ( fns ) , func ( i int ) { item , err := fns [ i ] ( ctx ) c <- intResult { item , err } } , func ( ) { close ( c ) } ) var ( out [ ] int errs multiError ) for res := range c { if res . err != nil { cancel ( ) errs = append ( errs , res . err ) continue } out = append ( out , res . item ) } return out , errs . ErrorOrNil ( ) }
ParallelIntCancelOnError runs the given functions in parallel, cancelling all if one fails.
ParallelIntCancelOnError runs the given functions in parallel cancelling all if one fails .