From 6361ea3188eff031859524db37f87a79968b5cfb Mon Sep 17 00:00:00 2001 From: Darien Raymond Date: Tue, 18 Apr 2017 12:41:36 +0200 Subject: [PATCH] refactor --- common/buf/buffered_reader.go | 3 +-- common/buf/buffered_writer.go | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/common/buf/buffered_reader.go b/common/buf/buffered_reader.go index 4a9479214..8c7630ec8 100644 --- a/common/buf/buffered_reader.go +++ b/common/buf/buffered_reader.go @@ -40,8 +40,7 @@ func (v *BufferedReader) Read(b []byte) (int, error) { return v.reader.Read(b) } if v.buffer.IsEmpty() { - err := v.buffer.AppendSupplier(ReadFrom(v.reader)) - if err != nil { + if err := v.buffer.Reset(ReadFrom(v.reader)); err != nil { return 0, err } } diff --git a/common/buf/buffered_writer.go b/common/buf/buffered_writer.go index 94dff1847..cae5945d5 100644 --- a/common/buf/buffered_writer.go +++ b/common/buf/buffered_writer.go @@ -28,8 +28,7 @@ func (v *BufferedWriter) Write(b []byte) (int, error) { return 0, err } if v.buffer.IsFull() { - err := v.Flush() - if err != nil { + if err := v.Flush(); err != nil { return 0, err } if nBytes < len(b) {