-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
{,x-pack/}{auditbeat,packetbeat,winlogbeat,filebeat/input/httpjson}: fix lint and silence linters #31008
Conversation
…fix lint and silence linters
Pinging @elastic/security-external-integrations (Team:Security-External Integrations) |
@@ -146,7 +146,7 @@ func decodeAsCSV(p []byte, dst *response) error { | |||
// values to keys in the event | |||
header, err := r.Read() | |||
if err != nil { | |||
if err == io.EOF { | |||
if err == io.EOF { //nolint:errorlint // csv.Reader never wraps io.EOF. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While this is true, maybe we should go ahead and change these two over to to errors.Is() anyways?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not convinced. Errors is requires at least one call to reflectlite in all cases in order to check whether the error value is comparable. I think that if we know that the error is always unwrapped (for example it comes from a stdlib function that always did, like in the case of all uses of io.EOF
) then it would be better to use the old convention; also for readability (though this is harmed by nolint spam).
I am happy to go over and change them all if you feel strongly about it though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't feel strongly about. I just haven't accepted that we'll have so many of these//nolint
statements 😄.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just haven't accepted that we'll have so many of these
//nolint
statements 😄.
Indeed. This is a consequence of the approach that golangci-lint takes to linting; it tries to cover too much and it does so with sometimes less than careful linters.
The nolint directives will help with the follow up to the linting process though; if we see many unuseful lint complaints from a particular linter we can argue to have it removed.
Co-authored-by: Andrew Kroh <andrew.kroh@elastic.co>
…fix lint and silence linters (elastic#31008) Co-authored-by: Andrew Kroh <andrew.kroh@elastic.co>
…fix lint and silence linters (#31008) Co-authored-by: Andrew Kroh <andrew.kroh@elastic.co>
What does this PR do?
Fixes lint or suppresses linter complaints depending on issue.
Why is it important?
This will remove the need to include irrelevant diff noise in future PRs forced by the linter.
Checklist
- [ ] I have made corresponding changes to the documentation- [ ] I have made corresponding change to the default configuration files- [ ] I have added tests that prove my fix is effective or that my feature works- [ ] I have added an entry inCHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.Author's Checklist
How to test this PR locally
Related issues
Use cases
Screenshots
Logs