type ErrorTracker … // NewErrorTracker makes a new error tracker; note that it implements io.Writer. func NewErrorTracker(w io.Writer) *ErrorTracker { … } // Write intercepts calls to Write. func (et *ErrorTracker) Write(p []byte) (n int, err error) { … } // Error returns nil if no error has occurred, otherwise it returns the error. func (et *ErrorTracker) Error() error { … }