fix buffer reset

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
2026-02-03 09:26:40 +03:00
parent 77d1582543
commit b55375fd89
2 changed files with 6 additions and 4 deletions

View File

@@ -6,8 +6,10 @@ import (
)
var _ interface {
io.ReadCloser
io.ReadSeeker
io.Reader
io.Seeker
io.Writer
io.Closer
} = (*SeekerBuffer)(nil)
// SeekerBuffer is a ReadWriteCloser that supports seeking. It's intended to
@@ -95,7 +97,7 @@ func (b *SeekerBuffer) Close() error {
// Reset clears all the data out of the buffer and sets the read position to 0.
func (b *SeekerBuffer) Reset() {
b.data = nil
b.data = b.data[:0]
b.pos = 0
}

View File

@@ -296,7 +296,7 @@ func TestSeekerBuffer_Reset(t *testing.T) {
buf.pos = 2
buf.Reset()
require.Nil(t, buf.data)
require.Equal(t, []byte{}, buf.data)
require.Equal(t, int64(0), buf.pos)
}