chore(lint): bump golangci-lint to v2.11.1 (#7905)

- Added nolint to plugin/auto/walk.go to avoid a symlink/TOCTOU
  warning, as it needs to follow symlink.
- Replaced a few flagged integer conversions with safe equivalents in
  cache hashing, reuseport socket setup, and TLS arg handling
- Preallocated response rule slices in plugin/rewrite/name.go
- Replaced WriteString(fmt.Sprintf/Sprintln(...)) with direct
  fmt.Fprint* calls
- Removed stale nolint directives from code and tests that are no
  longer needed

Signed-off-by: Ville Vesilehto <ville@vesilehto.fi>
This commit is contained in:
Ville Vesilehto
2026-03-06 21:50:24 +02:00
committed by GitHub
parent ab04d3c0ca
commit 90a9739478
12 changed files with 41 additions and 23 deletions

View File

@@ -161,10 +161,11 @@ func (rule *nameRuleBase) responseRuleFor(state request.Request) (ResponseRules,
}
rewriter := newRemapStringRewriter(state.Req.Question[0].Name, state.Name())
rules := ResponseRules{
rules := make(ResponseRules, 0, 2+len(rule.static))
rules = append(rules,
&nameRewriterResponseRule{rewriter},
&valueRewriterResponseRule{rewriter},
}
)
return append(rules, rule.static...), RewriteDone
}
@@ -221,15 +222,16 @@ type suffixNameRule struct {
}
func newSuffixNameRule(nextAction string, auto bool, suffix, replacement string, answers ResponseRules) Rule {
var rules ResponseRules
rules := make(ResponseRules, 0, len(answers))
if auto {
// for a suffix rewriter better standard response rewrites can be done
// just by using the original suffix/replacement in the opposite order
rewriter := newSuffixStringRewriter(replacement, suffix)
rules = ResponseRules{
rules = make(ResponseRules, 0, 2+len(answers))
rules = append(rules,
&nameRewriterResponseRule{rewriter},
&valueRewriterResponseRule{rewriter},
}
)
}
return &suffixNameRule{
newNameRuleBase(nextAction, false, replacement, append(rules, answers...)),