func forEachString(
	ctx context.Context,
	strings []string,
	f func(context.Context, string) error) (err error) {
	b := syncutil.NewBundle(ctx)

	// Feed strings into a channel.
	c := make(chan string, len(strings))
	for _, s := range strings {
		c <- s
	}
	close(c)

	// Consume the strings.
	const parallelism = 128
	for i := 0; i < parallelism; i++ {
		b.Add(func(ctx context.Context) (err error) {
			for s := range c {
				err = f(ctx, s)
				if err != nil {
					return
				}
			}
			return
		})
	}

	err = b.Join()
	return
}
// Invoke the supplied function for each string, with some degree of
// parallelism.
Invoke the supplied function for each string, with some degree of
parallelism.
// Invoke the supplied function for each string with some degree of // parallelism .
func forEachString(
	ctx context.Context,
	strings []string,
	f func(context.Context, string) error) (err error) {
	b := syncutil.NewBundle(ctx)
	c := make(chan string, len(strings))
	for _, s := range strings {
		c <- s
	}
	close(c)
	const parallelism = 128
	for i := 0; i < parallelism; i++ {
		b.Add(func(ctx context.Context) (err error) {
			for s := range c {
				err = f(ctx, s)
				if err != nil {
					return
				}
			}
			return
		})
	}
	err = b.Join()
	return
}
func forEachString ( ctx context . Context , strings [ ] string , f func ( context . Context , string ) error ) ( err error ) { b := syncutil . NewBundle ( ctx ) c := make ( chan string , len ( strings ) ) for _ , s := range strings { c <- s } close ( c ) const parallelism = 128 for i := 0 ; i < parallelism ; i ++ { b . Add ( func ( ctx context . Context ) ( err error ) { for s := range c { err = f ( ctx , s ) if err != nil { return } } return } ) } err = b . Join ( ) return }
Invoke the supplied function for each string, with some degree of
parallelism.
Invoke the supplied function for each string with some degree of parallelism .
// Feed strings into a channel. // Consume the strings.