fix(plugin): nilness findings (#7556)

Enable nilness linter in govet.

Plugin-by-plugin rationale:

- plugin/transfer: reuse error instead of shadowing it inside the for
  loop by declaring "ret" outside of the loop
- plugin/view: remove redundant err check
- plugin/dnstap: avoid possible nil dereference in error reporting
  path in setup test
- plugin/forward: prevent nil deference or empty-slice dereference on
  error paths in setup test

Signed-off-by: Ville Vesilehto <ville@vesilehto.fi>
This commit is contained in:
Ville Vesilehto
2025-09-15 20:17:06 +03:00
committed by GitHub
parent 4073862045
commit c916cf4259
5 changed files with 9 additions and 7 deletions

View File

@@ -39,10 +39,11 @@ func (t *Transfer) Notify(zone string) error {
func sendNotify(c *dns.Client, m *dns.Msg, s string) error {
var err error
var ret *dns.Msg
code := dns.RcodeServerFailure
for range 3 {
ret, _, err := c.Exchange(m, s)
ret, _, err = c.Exchange(m, s)
if err != nil {
continue
}