Skip to content

Commit

Permalink
Minor linting changes
Browse files Browse the repository at this point in the history
  • Loading branch information
atomirex committed Dec 21, 2024
1 parent 72e439d commit d8230f8
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Check failure on line 1164 in conn.go

View workflow job for this annotation

GitHub Actions / lint / Go

missing cases in switch of type dnsmessage.Type: dnsmessage.TypeNS, dnsmessage.TypeCNAME, dnsmessage.TypeSOA, dnsmessage.TypePTR, dnsmessage.TypeMX, dnsmessage.TypeTXT, dnsmessage.TypeSRV, dnsmessage.TypeOPT, dnsmessage.TypeWKS, dnsmessage.TypeHINFO, dnsmessage.TypeMINFO, dnsmessage.TypeAXFR, dnsmessage.TypeALL (exhaustive)
case dnsmessage.TypeA:
Expand All @@ -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")

Check failure on line 1173 in conn.go

View workflow job for this annotation

GitHub Actions / lint / Go

do not define dynamic errors, use wrapped static errors instead: "fmt.Errorf(\"failed to create netip.Addr from TypeA resource\")" (err113)

Check warning on line 1173 in conn.go

View check run for this annotation

Codecov / codecov/patch

conn.go#L1173

Added line #L1173 was not covered by tests
}
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")

Check failure on line 1182 in conn.go

View workflow job for this annotation

GitHub Actions / lint / Go

do not define dynamic errors, use wrapped static errors instead: "fmt.Errorf(\"failed to create netip.Addr from TypeAAAA resource\")" (err113)

Check warning on line 1182 in conn.go

View check run for this annotation

Codecov / codecov/patch

conn.go#L1182

Added line #L1182 was not covered by tests
}
}

Expand Down

0 comments on commit d8230f8

Please sign in to comment.