Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Address golangci-lint v1.60.3 errors #1631

Merged
merged 2 commits into from
Aug 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ linters:
- bidichk
- bodyclose
- contextcheck
- copyloopvar
# - cyclop # This is equivalent to gocyclo
# - depguard # depguard now denies by default, it should only be enabled if we actually use it
- dogsled
Expand All @@ -53,7 +54,6 @@ linters:
- errname
- exhaustive
# - exhaustivestruct # Not recommended for general use - meant to be used only for special cases
- exportloopref
# - forbidigo # We don't forbid any statements
# - forcetypeassert # There are many unchecked type assertions that would be the result of a programming error so the
# reasonable recourse would be to panic anyway if checked so this doesn't seem useful
Expand Down
2 changes: 1 addition & 1 deletion coredns/plugin/record.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func (lh *Lighthouse) createSRVRecords(dnsrecords []resolver.DNSRecord, state *r
Hdr: dns.RR_Header{Name: state.QName(), Rrtype: dns.TypeSRV, Class: state.QClass(), Ttl: lh.TTL},
Priority: 0,
Weight: 50,
Port: uint16(port.Port),
Port: uint16(port.Port), //nolint:gosec // Need to ignore integer conversion error
Target: target,
}
records = append(records, record)
Expand Down
4 changes: 2 additions & 2 deletions coredns/plugin/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ func parseTTL(c *caddy.Controller) (uint32, error) {
return 0, c.ArgErr() //nolint:wrapcheck // No need to wrap this.
}

t, err := strconv.Atoi(args[0])
t, err := strconv.ParseInt(args[0], 10, 32)
if err != nil {
return 0, errors.Wrap(err, "error parsing TTL")
}
Expand All @@ -186,7 +186,7 @@ func parseTTL(c *caddy.Controller) (uint32, error) {
return 0, c.Errf("ttl must be in range [0, 3600]: %d", t) //nolint:wrapcheck // No need to wrap this.
}

return uint32(t), nil
return uint32(t), nil //nolint:gosec // We can safely ignore integer conversion error
}

func init() {
Expand Down
Loading