From d2480a60599e250c6059fce8ab580d0c667ea4d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Stemmer?= Date: Tue, 7 Jun 2022 00:58:39 +0100 Subject: [PATCH] parser/gotest: Skip ID 0 when searching for existing tests or benchmarks --- parser/gotest/report_builder.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/parser/gotest/report_builder.go b/parser/gotest/report_builder.go index a326fa0..ede083f 100644 --- a/parser/gotest/report_builder.go +++ b/parser/gotest/report_builder.go @@ -309,7 +309,7 @@ func (b *reportBuilder) findTest(name string) (int, bool) { if t, ok := b.tests[b.lastID]; ok && t.Name == name { return b.lastID, true } - for i := b.nextID; i >= 0; i-- { + for i := b.nextID; i > 0; i-- { if test, ok := b.tests[i]; ok && test.Name == name { return i, true } @@ -347,7 +347,7 @@ func (b *reportBuilder) findBenchmark(name string) (int, bool) { if bm, ok := b.benchmarks[b.lastID]; ok && bm.Name == name { return b.lastID, true } - for id := len(b.benchmarks); id >= 0; id-- { + for id := len(b.benchmarks); id > 0; id-- { if b.benchmarks[id].Name == name { return id, true }