From 321f5fe368eb5b2cfc5079e2da38a02d0f02d330 Mon Sep 17 00:00:00 2001 From: Roy Crihfield Date: Sun, 6 Sep 2020 12:52:16 -0500 Subject: [PATCH] don't prepend (nil, 0], make first bin start at nil --- pkg/iterator/iterator.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pkg/iterator/iterator.go b/pkg/iterator/iterator.go index e4cc2f3..e2857ae 100644 --- a/pkg/iterator/iterator.go +++ b/pkg/iterator/iterator.go @@ -138,9 +138,8 @@ func MakePaths(prefix []byte, nbins uint) [][]byte { func eachPrefixRange(prefix []byte, nbins uint, callback func ([]byte, []byte)) { prefixes := MakePaths(prefix, nbins) - // pre- and postpend nil to include root & tail - prefixes = append(prefixes, nil) - prefixes = append([][]byte{nil}, prefixes...) + prefixes = append(prefixes, nil) // include tail + prefixes[0] = nil // set bin 0 left bound to nil to include root for i := 0; i < len(prefixes)-1; i++ { key := prefixes[i] if len(key)%2 != 0 { // zero-pad for odd-length keys