aboutsummaryrefslogtreecommitdiff
path: root/common/iowrap/nop_flush.go
blob: 38fc5f55d76a5e05c013afad955f3b3ed9b6feec (about) (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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
}