// ParallelStringCancelOnError 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.
ParallelStringCancelOnError 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.
// ParallelStringCancelOnError 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) ParallelStringCancelOnError(ctx context.Context, fns ...StringFunc) ([]string, error) {
	if len(fns) == 0 {
		return nil, nil
	}
	ctx, cancel := context.WithCancel(ctx)
	defer cancel()
	c := make(chan stringResult)
	f.runAll(len(fns), func(i int) {
		item, err := fns[i](ctx)
		c <- stringResult{item, err}
	}, func() { close(c) })
	var (
		out  []string
		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 ) ParallelStringCancelOnError ( ctx context . Context , fns ... StringFunc ) ( [ ] string , error ) { if len ( fns ) == 0 { return nil , nil } ctx , cancel := context . WithCancel ( ctx ) defer cancel ( ) c := make ( chan stringResult ) f . runAll ( len ( fns ) , func ( i int ) { item , err := fns [ i ] ( ctx ) c <- stringResult { item , err } } , func ( ) { close ( c ) } ) var ( out [ ] string 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 ( ) }
ParallelStringCancelOnError runs the given functions in parallel, cancelling all if one fails.
ParallelStringCancelOnError runs the given functions in parallel cancelling all if one fails .