-
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/}filebeat: clean up dead code #30483
Conversation
This pull request doesn't have a |
d4b478e
to
18c8fda
Compare
Pinging @elastic/security-external-integrations (Team:Security-External Integrations) |
[git-generate] gofumpt -w ./{,x-pack/}filebeat
This removes the majority of unused identified by running: staticcheck -checks 'U*' ./{,x-pack/}filebeat/... Care has been taken to not remove platform-specific code and mage-required code.
This has been split into 4 parts to ease review; the filebeat part remains here and the auditbeat, packetbeat and winlogbeat parts can be found at the mention links above. |
Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane) |
@@ -195,17 +189,6 @@ func (r rotatedFilestreams) addRotatedFile(original, rotated string, src loginp. | |||
return -1 | |||
} | |||
|
|||
// addRotatedFile adds a new rotated file to the list and returns its index. | |||
// if a file is already added, the source is updated and the index is returned. | |||
func (r rotatedFilestreams) removeRotatedFile(original, rotated string) { |
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.
For a SME: Perhaps this is a bug and this was meant to be used somewhere?
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.
@kvch thoughts on if this is a bug or not?
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 think it is a leftover from my work. I implemented a few different approaches for tracking rotated files. I probably forgot to clean up a few functions or kept it for when we will support rotating input files. IDK. But for now it can be removed.
Thanks! FYI we are working through enabling the golangci-lint meta linter in some of the smaller repositories, starting with the Hopefully we can introduce that configuration (which includes |
@cmacknz Great 👍 . We've just did this with go-libaudit and enabled the Github Action to check PRs. Any plans to introduce it to the Beats repo? Maybe we could enable the GH action and only check for new issues introduced in PRs. |
I would like to get golangci-lint enabled in the beats repo, we just need a sensible plan to introduce it. I like your idea of only checking if new issues were introduced, but I haven't investigated how to implement it yet. |
The CLI tool supports a |
What does this PR do?
This change removes unused code and cleans up the code formatting.
Why is it important?
Deadcode reduces code base maintainability.
Checklist
- [ ] I have commented my code, particularly in hard-to-understand areas- [ ] 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
Audit beat was not reformatted because that is already happening in #30321.How to test this PR locally
Related issues
Use cases
Screenshots
Logs