From ffd4bfad96fd58ef4e44d70e63eeb8dc5a26165f Mon Sep 17 00:00:00 2001 From: qydysky <32743305+qydysky@users.noreply.github.com> Date: Thu, 2 Mar 2023 23:15:05 +0800 Subject: [PATCH] Fix slice --- slice/Slice.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/slice/Slice.go b/slice/Slice.go index 0120c3e..900935d 100644 --- a/slice/Slice.go +++ b/slice/Slice.go @@ -71,7 +71,7 @@ func (t *Buf[T]) Append(data []T) error { t.buf = make([]T, len(data), t.maxsize) } } else { - diff := len(t.buf) - t.bufsize - len(data) + diff := cap(t.buf) - t.bufsize - len(data) if diff < 0 { t.buf = append(t.buf, make([]T, -diff)...) } else { -- 2.39.2