diff --git a/pkg/list/list_test.go b/pkg/list/list_test.go index cd8ee3b..cd071c4 100644 --- a/pkg/list/list_test.go +++ b/pkg/list/list_test.go @@ -2,9 +2,9 @@ package list import "testing" -func checkListLen[T any](t *testing.T, l *List[T], len int) bool { - if n := l.Len(); n != len { - t.Errorf("l.Len() = %d, want %d", n, len) +func checkListLen[T any](t *testing.T, l *List[T], length int) bool { + if n := l.Len(); n != length { + t.Errorf("l.Len() = %d, want %d", n, length) return false } return true diff --git a/pkg/omap/omap_test.go b/pkg/omap/omap_test.go index 2c33bea..4bebc02 100644 --- a/pkg/omap/omap_test.go +++ b/pkg/omap/omap_test.go @@ -294,6 +294,7 @@ func TestGetAndMove(t *testing.T) { value, err = om.GetAndMoveToBack(100) assert.Equal(t, &KeyNotFoundError[int]{100}, err) + assert.Nil(t, value) } func TestAddPairs(t *testing.T) { diff --git a/pkg/omap/wbuf.go b/pkg/omap/wbuf.go index 090ae49..d962405 100644 --- a/pkg/omap/wbuf.go +++ b/pkg/omap/wbuf.go @@ -44,9 +44,6 @@ func putBuf(buf []byte) { if size < config.PooledSize { return } - if c := buffers[size]; c != nil { - c.Put(buf[:0]) - } } // getBuf gets a chunk from reuse pool or creates a new one if reuse failed. @@ -76,11 +73,11 @@ type Buffer struct { // possibly creating a new chunk. func (b *Buffer) EnsureSpace(s int) { if cap(b.Buf)-len(b.Buf) < s { - b.ensureSpaceSlow(s) + b.ensureSpaceSlow() } } -func (b *Buffer) ensureSpaceSlow(p int) { +func (b *Buffer) ensureSpaceSlow() { l := len(b.Buf) if l > 0 { if cap(b.toPool) != cap(b.Buf) { diff --git a/pkg/omap/writer.go b/pkg/omap/writer.go index 97a2334..9240c4a 100644 --- a/pkg/omap/writer.go +++ b/pkg/omap/writer.go @@ -11,8 +11,10 @@ import ( type Flags int const ( - NilMapAsEmpty Flags = 1 << iota // Encode nil map as '{}' rather than 'null'. - NilSliceAsEmpty // Encode nil slice as '[]' rather than 'null'. + // NilMapAsEmpty encodes nil map as '{}' rather than 'null'. + NilMapAsEmpty Flags = 1 << iota + // NilSliceAsEmpty encodes nil slice as '[]' rather than 'null'. + NilSliceAsEmpty ) // Writer is a JSON writer.