func (w *StreamWriter) ErrorSet() <-chan struct{} {
	return w.err.ErrorSet()
}
ErrorSet returns a channel which will be closed
if an error occurs.
package eventstreamapi
import (
	"fmt"
	"io"
	"sync"
	"github.com/aws/aws-sdk-go/aws"
)
type StreamWriter struct {
	eventWriter *EventWriter
	stream      chan eventWriteAsyncReport
	done      chan struct{}
	closeOnce sync.Once
	err       *OnceError
	streamCloser io.Closer
}
func NewStreamWriter(eventWriter *EventWriter, streamCloser io.Closer) *StreamWriter {
	w := &StreamWriter{
		eventWriter:  eventWriter,
		streamCloser: streamCloser,
		stream:       make(chan eventWriteAsyncReport),
		done:         make(chan struct{}),
		err:          NewOnceError(),
	}
	go w.writeStream()
	return w
}
func (w *StreamWriter) Close() error {
	w.closeOnce.Do(w.safeClose)
	return w.Err()
}
func (w *StreamWriter) safeClose() {
	close(w.done)
}