From d0ca09b7d131678325d47f44ee8b61f93e3c2eff Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Sat, 12 Jan 2019 18:31:41 -0800 Subject: [PATCH] remove pointless interface --- streaming/bytewriter.go | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/streaming/bytewriter.go b/streaming/bytewriter.go index 1ef4da2..801ded7 100644 --- a/streaming/bytewriter.go +++ b/streaming/bytewriter.go @@ -5,20 +5,16 @@ import ( "io" ) -type Writer interface { - io.WriteSeeker -} - -type writer struct { +type Writer struct { data []byte offset int } -func NewWriter(data []byte) Writer { - return &writer{data, 0} +func NewWriter(data []byte) *Writer { + return &Writer{data, 0} } -func (w *writer) Write(data []byte) (int, error) { +func (w *Writer) Write(data []byte) (int, error) { length := len(data) if w.offset+length > len(w.data) { length = len(w.data) - w.offset @@ -34,7 +30,7 @@ func (w *writer) Write(data []byte) (int, error) { return length, nil } -func (w *writer) Seek(offset int64, whence int) (int64, error) { +func (w *Writer) Seek(offset int64, whence int) (int64, error) { result := w.offset switch whence { case io.SeekStart: