made buffers.NewWriter() return a *buffers.Writer, rather than a buffers.Writer

master
Charles Iliya Krempeaux 2019-09-05 18:53:40 -07:00
parent a0e5c6762a
commit 068d259699
2 changed files with 4 additions and 4 deletions

View File

@ -8,8 +8,8 @@ type Writer struct {
index int index int
} }
func NewWriter(dst []byte) Writer { func NewWriter(dst []byte) *Writer {
return Writer{ return &Writer{
dst:dst, dst:dst,
} }
} }

View File

@ -292,7 +292,7 @@ func TestWriterSingleWrite(t *testing.T) {
var buffer []byte = make([]byte, test.BufferLength) var buffer []byte = make([]byte, test.BufferLength)
var dst buffers.Writer = buffers.NewWriter(buffer) var dst *buffers.Writer = buffers.NewWriter(buffer)
n, err := dst.Write(test.Src) n, err := dst.Write(test.Src)
if _, casted := err.(buffers.TooShort); !casted { if _, casted := err.(buffers.TooShort); !casted {
@ -857,7 +857,7 @@ func TestWriterMultipleWrites(t *testing.T) {
var buffer []byte = make([]byte, test.BufferLength) var buffer []byte = make([]byte, test.BufferLength)
var dst buffers.Writer = buffers.NewWriter(buffer) var dst *buffers.Writer = buffers.NewWriter(buffer)
var sum int var sum int