func Sequence(filters ...Filter) Filter {
	if len(filters) == 1 {
		return filters[0]
	}
	return FilterFunc(func(arg Arg) error {
		e := &filterErrors{}
		in := arg.In
		for _, f := range filters {
			c := make(chan string, channelBuffer)
			go runFilter(f, Arg{In: in, Out: c}, e)
			in = c
		}
		for s := range in {
			arg.Out <- s
		}
		return e.getError()
	})
}
Sequence returns a filter that is the concatenation of all filter arguments.
The output of a filter is fed as input to the next filter.
package stream
import "sync"
type filterErrors struct {
	mu  sync.Mutex
	err error
}
func (e *filterErrors) record(err error) {
	if err != nil {
		e.mu.Lock()
		if e.err == nil {
			e.err = err
		}
		e.mu.Unlock()
	}
}
func (e *filterErrors) getError() error {
	e.mu.Lock()
	defer e.mu.Unlock()
	return e.err
}
type Arg struct {
	In    <-chan string
	Out   chan<- string
	dummy bool  
}
type Filter interface {
	RunFilter(Arg) error
}
type FilterFunc func(Arg) error
func (f FilterFunc) RunFilter(arg Arg) error { return f(arg) }
const channelBuffer = 1000