diff --git a/roaring/containers_btree.go b/roaring/containers_btree.go index 62e08b9c6..280fd5edc 100644 --- a/roaring/containers_btree.go +++ b/roaring/containers_btree.go @@ -36,7 +36,10 @@ func NewBTreeBitmap(a ...uint64) *Bitmap { b := &Bitmap{ Containers: newBTreeContainers(), } - // TODO: We have no way to report this. + // We have no way to report this. + // Because we just created Bitmap, its OpWriter is nil, so there + // is no code path which would cause Add() to return an error. + // Therefore, it's safe to swallow this error. _, _ = b.Add(a...) return b } diff --git a/roaring/roaring.go b/roaring/roaring.go index 267e3b8c7..9605a6299 100644 --- a/roaring/roaring.go +++ b/roaring/roaring.go @@ -207,9 +207,12 @@ func NewBitmap(a ...uint64) *Bitmap { b := &Bitmap{ Containers: newSliceContainers(), } - // TODO: We have no way to report this. We aren't in a server context + // We have no way to report this. We aren't in a server context // so we haven't got a logger, nothing is checking for nil returns - // from this... + // from this. + // Because we just created Bitmap, its OpWriter is nil, so there + // is no code path which would cause AddN() to return an error. + // Therefore, it's safe to swallow this error. _, _ = b.AddN(a...) return b } @@ -222,9 +225,12 @@ func NewSliceBitmap(a ...uint64) *Bitmap { b := &Bitmap{ Containers: newSliceContainers(), } - // TODO: We have no way to report this. We aren't in a server context + // We have no way to report this. We aren't in a server context // so we haven't got a logger, nothing is checking for nil returns - // from this... + // from this. + // Because we just created Bitmap, its OpWriter is nil, so there + // is no code path which would cause AddN() to return an error. + // Therefore, it's safe to swallow this error. _, _ = b.AddN(a...) return b }