stream: fixed comment of NopEncoder simplified Write for noop

This commit is contained in:
Saxon 2019-03-14 11:30:39 +10:30
parent 9b3a1d0ae7
commit 00f2b66a8b
1 changed files with 2 additions and 3 deletions

View File

@ -34,7 +34,7 @@ type Encoder interface {
GetDst() io.Writer GetDst() io.Writer
} }
// NopEncoder returns an // NopEncoder returns an Encoder that performs no operation.
func NopEncoder(dst io.Writer) Encoder { func NopEncoder(dst io.Writer) Encoder {
return noop{dst} return noop{dst}
} }
@ -45,8 +45,7 @@ type noop struct {
// Write implements io.Writer. // Write implements io.Writer.
func (e noop) Write(p []byte) (int, error) { func (e noop) Write(p []byte) (int, error) {
n, err := e.dst.Write(p) return e.dst.Write(p)
return n, err
} }
func (e noop) GetDst() io.Writer { return e.dst } func (e noop) GetDst() io.Writer { return e.dst }