refactor: Decompose key checks
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
package noop
|
||||
|
||||
import "io"
|
||||
|
||||
type Flusher interface {
|
||||
io.WriteCloser
|
||||
|
||||
Flush() error
|
||||
}
|
||||
|
||||
type NoOpFlusher struct {
|
||||
io.WriteCloser
|
||||
}
|
||||
|
||||
func (NoOpFlusher) Flush() error { return nil }
|
||||
|
||||
func AddFlush(w io.WriteCloser) NoOpFlusher {
|
||||
return NoOpFlusher{w}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package noop
|
||||
|
||||
import "io"
|
||||
|
||||
type NoOpCloser struct {
|
||||
io.Writer
|
||||
}
|
||||
|
||||
func (NoOpCloser) Close() error { return nil }
|
||||
|
||||
func AddClose(w io.Writer) NoOpCloser {
|
||||
return NoOpCloser{w}
|
||||
}
|
||||
Reference in New Issue
Block a user