From 7e8faa71692a4517c968e2a94beb24b4e218c533 Mon Sep 17 00:00:00 2001 From: Pierre-Olivier Mercier Date: Sat, 16 May 2026 13:14:05 +0800 Subject: [PATCH] refactor: deduplicate primary parent view selection in Collect Replace the inline loop with a call to the existing primaryParentView() helper so the selection algorithm lives in exactly one place. --- checker/collect.go | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/checker/collect.go b/checker/collect.go index f4fda00..0f6ad6d 100644 --- a/checker/collect.go +++ b/checker/collect.go @@ -89,13 +89,7 @@ func (p *delegationProvider) Collect(ctx context.Context, opts sdk.CheckerOption } // If no parent answered with an NS RRset, skip Phase B; rules flag the gap. - var primary *ParentView - for i := range data.ParentViews { - if data.ParentViews[i].UDPNSError == "" && len(data.ParentViews[i].NS) > 0 { - primary = &data.ParentViews[i] - break - } - } + primary := primaryParentView(data.ParentViews) if primary == nil { return data, nil }