// MultiWriter creates a writer that duplicates its writes to all the
// provided writers, similar to the Unix tee(1) command.
//
// Each write is written to each listed writer, one at a time.
// If a listed writer returns an error, that writer will be ignored
// for later writes.
// returns the multi writer and a func that returns a slice of errors if there were any.
MultiWriter creates a writer that duplicates its writes to all the
provided writers, similar to the Unix tee(1) command.

Each write is written to each listed writer, one at a time.
If a listed writer returns an error, that writer will be ignored
for later writes.
returns the multi writer and a func that returns a slice of errors if there were any.
// MultiWriter creates a writer that duplicates its writes to all the // provided writers similar to the Unix tee ( 1 ) command . // // Each write is written to each listed writer one at a time . // If a listed writer returns an error that writer will be ignored // for later writes . // returns the multi writer and a func that returns a slice of errors if there were any .
func MultiWriter(writers ...io.Writer) (io.Writer, func() []error) {
	allWriters := make([]io.Writer, 0, len(writers))
	for _, w := range writers {
		if mw, ok := w.(*multiWriter); ok {
			allWriters = append(allWriters, mw.writers...)
		} else {
			allWriters = append(allWriters, w)
		}
	}
	mw := &multiWriter{allWriters, nil}
	return mw, mw.getErrs
}
func MultiWriter ( writers ... io . Writer ) ( io . Writer , func ( ) [ ] error ) { allWriters := make ( [ ] io . Writer , 0 , len ( writers ) ) for _ , w := range writers { if mw , ok := w . ( * multiWriter ) ; ok { allWriters = append ( allWriters , mw . writers ... ) } else { allWriters = append ( allWriters , w ) } } mw := & multiWriter { allWriters , nil } return mw , mw . getErrs }
MultiWriter creates a writer that duplicates its writes to all the
provided writers, similar to the Unix tee(1) command.
MultiWriter creates a writer that duplicates its writes to all the provided writers similar to the Unix tee ( 1 ) command .