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

Move backwards compatible flag manipulation #41136

Closed

Conversation

leehinman
Copy link
Contributor

Proposed commit message

libbeat manipulates the command line arguments to support older single dash arguments, for example -e vs --e.
Currently this is done in an init function.
Doing it there means that if libbeat is imported into another code base with it's own command line parsing it will cause things like -1s to be interpreted as --1s instead of negative 1 second.

This PR moves the manipulation of the command line arguments to just before the call to flag.Parse().
This allows other code bases to import libbeat and not be affected by the backwards compatibility manipulation.

Checklist

  • My code follows the style guidelines of this project
  • 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 in CHANGELOG.next.asciidoc or CHANGELOG-developer.next.asciidoc.

Disruptive User Impact

Author's Checklist

  • [ ]

How to test this PR locally

Related issues

Use cases

Screenshots

Logs

Moving to just before flag.Parse.  Having in init conflicted with
using libbeat in other apps that have their own flag parsing.
@leehinman leehinman added bug Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team backport-8.x Automated backport to the 8.x branch with mergify labels Oct 4, 2024
@leehinman leehinman requested a review from a team as a code owner October 4, 2024 20:13
@leehinman leehinman requested review from faec and VihasMakwana October 4, 2024 20:13
@elasticmachine
Copy link
Collaborator

Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane)

@botelastic botelastic bot added needs_team Indicates that the issue/PR needs a Team:* label and removed needs_team Indicates that the issue/PR needs a Team:* label labels Oct 4, 2024
Copy link
Contributor

@blakerouse blakerouse left a comment

Choose a reason for hiding this comment

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

Looks good to me.

@cmacknz
Copy link
Member

cmacknz commented Oct 4, 2024

Is there a way for us to add a test for this?

@leehinman
Copy link
Contributor Author

Is there a way for us to add a test for this?

Yes. I just wanted to the the tests started

@leehinman
Copy link
Contributor Author

Closing this in favor of reverting changes that caused problems.

#41151
#41152

#41153 tracks effort that will need to happen to move past this.

@leehinman leehinman closed this Oct 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-8.x Automated backport to the 8.x branch with mergify bug Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants