From 6c45249fb50d700e8da79cf1a4511ab4ffa1f7ba Mon Sep 17 00:00:00 2001 From: Charles Korn Date: Thu, 12 Oct 2023 12:29:44 +1100 Subject: [PATCH] Make the linter happy --- storage/merge.go | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/storage/merge.go b/storage/merge.go index 43a7f5d334..0db63c992c 100644 --- a/storage/merge.go +++ b/storage/merge.go @@ -594,7 +594,17 @@ func (c *chainSampleIterator) Next() chunkenc.ValueType { for { currValueType = c.curr.Next() - if currValueType != chunkenc.ValNone { + + if currValueType == chunkenc.ValNone { + if c.curr.Err() != nil { + // Abort if we've hit an error. + return chunkenc.ValNone + } else if len(c.h) == 0 { + // No iterator left to iterate. + c.curr = nil + return chunkenc.ValNone + } + } else { currT = c.curr.AtT() if currT == c.lastT { // Ignoring sample for the same timestamp. @@ -614,13 +624,6 @@ func (c *chainSampleIterator) Next() chunkenc.ValueType { } // Current iterator does not hold the smallest timestamp. heap.Push(&c.h, c.curr) - } else if c.curr.Err() != nil { - // Abort if we've hit an error. - return chunkenc.ValNone - } else if len(c.h) == 0 { - // No iterator left to iterate. - c.curr = nil - return chunkenc.ValNone } c.curr = heap.Pop(&c.h).(chunkenc.Iterator)