Permalink
Browse files

cleanup writer pusher flush

  • Loading branch information...
peter-edge committed Jan 20, 2016
1 parent 1214b28 commit 73e1c8448bcce5144316d516400da4f203fa33b2
Showing with 5 additions and 9 deletions.
  1. +5 −9 write_pusher.go
View
@@ -12,6 +12,10 @@ var (
newlineBytes = []byte{'\n'}
)
type syncer interface {
Sync() error
}
type writePusher struct {
writer io.Writer
marshaller Marshaller
@@ -34,18 +38,10 @@ func newWritePusher(writer io.Writer, marshaller Marshaller) *writePusher {
return writePusher
}
type flusher interface {
Flush() error
}
type syncer interface {
Sync() error
}
func (w *writePusher) Flush() error {
if syncer, ok := w.writer.(syncer); ok {
return syncer.Sync()
} else if flusher, ok := w.writer.(flusher); ok {
} else if flusher, ok := w.writer.(Flusher); ok {
return flusher.Flush()
}
return nil

0 comments on commit 73e1c84

Please sign in to comment.