From e55ee40fc88c3f0f2da4caf106c0660181fd848e Mon Sep 17 00:00:00 2001 From: atomirex Date: Sat, 21 Dec 2024 16:04:21 -0500 Subject: [PATCH] Minor linting changes --- conn.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/conn.go b/conn.go index 674044e..b8ea76a 100644 --- a/conn.go +++ b/conn.go @@ -1159,6 +1159,7 @@ func (c *Conn) start(started chan<- struct{}, inboundBufferSize int, config *Con } } +//nolint:gocognit func addrFromAnswerHeader(answer dnsmessage.Resource) (*netip.Addr, error) { switch answer.Header.Type { case dnsmessage.TypeA: @@ -1167,18 +1168,18 @@ func addrFromAnswerHeader(answer dnsmessage.Resource) (*netip.Addr, error) { if ok { addr = addr.Unmap() // do not want 4-in-6 return &addr, nil - } else { - return nil, fmt.Errorf("failed to create netip.Addr from TypeA resource") } + + return nil, fmt.Errorf("failed to create netip.Addr from TypeA resource") } case dnsmessage.TypeAAAA: if a, ok := answer.Body.(*dnsmessage.AAAAResource); ok { addr, ok := netip.AddrFromSlice(a.AAAA[:]) if ok { return &addr, nil - } else { - return nil, fmt.Errorf("failed to create netip.Addr from TypeAAAA resource") } + + return nil, fmt.Errorf("failed to create netip.Addr from TypeAAAA resource") } }