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

Fix some lint checks by (go) staticcheck ./... #1442

Merged
merged 1 commit into from Mar 28, 2023
Merged

Fix some lint checks by (go) staticcheck ./... #1442

merged 1 commit into from Mar 28, 2023

Conversation

systemcrash
Copy link
Contributor

Minimally invasive, identical behaviour.

Some warn about deprecation.

There are a few more which require some more thought.

Copy link
Collaborator

@tmthrgd tmthrgd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. A few changes though.

dnssec.go Outdated Show resolved Hide resolved
dnssec.go Outdated Show resolved Hide resolved
msg.go Outdated Show resolved Hide resolved
msg_helpers_test.go Outdated Show resolved Hide resolved
msg_helpers_test.go Outdated Show resolved Hide resolved
parse_test.go Outdated Show resolved Hide resolved
msg.go Show resolved Hide resolved
@tmthrgd
Copy link
Collaborator

tmthrgd commented Mar 17, 2023

Would you mind adding the entire output of staticcheck as comment just for reference?

@systemcrash
Copy link
Contributor Author

Before PR

clientconfig_test.go:4:2: "io/ioutil" has been deprecated since Go 1.19: As of Go 1.16, the same functionality is now provided by package io or package os, and those implementations should be preferred in new code. See the specific function documentation for details.  (SA1019)
dnssec.go:131:6: func divRoundUp is unused (U1000)
dnssec.go:421:2: empty branch (SA9003)
generate_test.go:5:2: "io/ioutil" has been deprecated since Go 1.19: As of Go 1.16, the same functionality is now provided by package io or package os, and those implementations should be preferred in new code. See the specific function documentation for details.  (SA1019)
msg.go:873:2: empty branch (SA9003)
msg_helpers_test.go:437:8: use net.IP.Equal to compare net.IPs, not bytes.Equal (SA1021)
msg_helpers_test.go:586:7: use net.IP.Equal to compare net.IPs, not bytes.Equal (SA1021)
parse_test.go:234:6: func testTXTRRQuick is unused (U1000)
scan_test.go:5:2: "io/ioutil" has been deprecated since Go 1.19: As of Go 1.16, the same functionality is now provided by package io or package os, and those implementations should be preferred in new code. See the specific function documentation for details.  (SA1019)
server.go:462:44: neterr.Temporary has been deprecated since Go 1.18 because it shouldn't be used: Temporary errors are not well-defined. Most "temporary" errors are timeouts, and the few exceptions are surprising. Do not use this method.  (SA1019)
server.go:521:44: netErr.Temporary has been deprecated since Go 1.18 because it shouldn't be used: Temporary errors are not well-defined. Most "temporary" errors are timeouts, and the few exceptions are surprising. Do not use this method.  (SA1019)
server.go:528:21: argument should be pointer-like to avoid allocations (SA6002)
server.go:640:20: argument should be pointer-like to avoid allocations (SA6002)
server.go:656:19: argument should be pointer-like to avoid allocations (SA6002)
server.go:697:19: argument should be pointer-like to avoid allocations (SA6002)
server.go:715:19: argument should be pointer-like to avoid allocations (SA6002)

After

server.go:462:44: neterr.Temporary has been deprecated since Go 1.18 because it shouldn't be used: Temporary errors are not well-defined. Most "temporary" errors are timeouts, and the few exceptions are surprising. Do not use this method.  (SA1019)
server.go:521:44: netErr.Temporary has been deprecated since Go 1.18 because it shouldn't be used: Temporary errors are not well-defined. Most "temporary" errors are timeouts, and the few exceptions are surprising. Do not use this method.  (SA1019)
server.go:528:21: argument should be pointer-like to avoid allocations (SA6002)
server.go:640:20: argument should be pointer-like to avoid allocations (SA6002)
server.go:656:19: argument should be pointer-like to avoid allocations (SA6002)
server.go:697:19: argument should be pointer-like to avoid allocations (SA6002)
server.go:715:19: argument should be pointer-like to avoid allocations (SA6002)

Copy link
Collaborator

@tmthrgd tmthrgd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One last nit.

@systemcrash
Copy link
Contributor Author

One last nit.

msg.go:863:3: this value of off is never used (SA4006)

@tmthrgd
Copy link
Collaborator

tmthrgd commented Mar 23, 2023

Okay that was missed out of the comment above. Yeah sure add the off -> _ change back in.

Quick thing though, please don't force push as it messes up our ability to review PRs. Just add new commits to the branch.

Some warn about deprecation.

PR #1445 already refactored out deprecated ioutil package
Copy link
Collaborator

@tmthrgd tmthrgd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@miekg miekg merged commit 5cac7fb into miekg:master Mar 28, 2023
4 checks passed
@systemcrash systemcrash deleted the static_checks_lint branch March 28, 2023 23:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants