From 3e762bc60323e170ef609df13c5154a59b2ea400 Mon Sep 17 00:00:00 2001 From: JUN YANG Date: Fri, 22 May 2026 03:11:29 +0800 Subject: [PATCH] Remove redundant code (#8072) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Yang Jun Signed-off-by: 杨军10092085 --- plugin/file/lookup.go | 5 ----- plugin/rewrite/name.go | 5 +---- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/plugin/file/lookup.go b/plugin/file/lookup.go index c8cc88e7d..64ff45c5a 100644 --- a/plugin/file/lookup.go +++ b/plugin/file/lookup.go @@ -168,11 +168,6 @@ func (z *Zone) Lookup(ctx context.Context, state request.Request, qname string) i++ } - // What does found and !shot mean - do we ever hit it? - if found && !shot { - return nil, nil, nil, ServerFailure - } - // Found entire name. if found && shot { if rrs := elem.Type(dns.TypeCNAME); len(rrs) > 0 && qtype != dns.TypeCNAME { diff --git a/plugin/rewrite/name.go b/plugin/rewrite/name.go index 4a05ef54f..e726c9c95 100644 --- a/plugin/rewrite/name.go +++ b/plugin/rewrite/name.go @@ -371,10 +371,7 @@ func parseAnswerRules(name string, args []string) (auto bool, rules ResponseRule } for arg < len(args) { if last == "" && args[arg] != AnswerMatch { - if last == "" { - return false, nil, fmt.Errorf("exceeded the number of arguments for a non-answer rule argument for %s rule", name) - } - return false, nil, fmt.Errorf("exceeded the number of arguments for %s answer rule for %s rule", last, name) + return false, nil, fmt.Errorf("exceeded the number of arguments for a non-answer rule argument for %s rule", name) } if args[arg] == AnswerMatch { arg++