shithub: furgit

ref: 9bd37998c9ea890401b66604806f7d1fe06b9256
dir: /common/iowrap/nop_flush.go/

View raw version
package iowrap

import "io"

type nopFlusher struct {
	io.Writer
}

// NopFlush adapts writer into a WriteFlusher with a no-op Flush.
func NopFlush(writer io.Writer) WriteFlusher {
	if writer == nil {
		return nil
	}

	return nopFlusher{Writer: writer}
}

func (nopFlusher) Flush() error {
	return nil
}