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

internal/pkg/agent/cmd: remove redundant addCommandIfNotNil func #7502

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

efd6
Copy link
Contributor

@efd6 efd6 commented Mar 20, 2025

What does this PR do?

None of the subcommand construction functions return a nil *cobra.Command, althought this was apparently the case in the past. So remove the wrapper func and its tests.

Why is it important?

Reduce complexity and bugspace.

Checklist

  • I have read and understood the pull request guidelines of this project.
  • 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/fragments using the changelog tool
  • I have added an integration test or an E2E test

Disruptive User Impact

How to test this PR locally

Related issues

Questions to ask yourself

  • How are we going to support this in production?
  • How are we going to measure its adoption?
  • How are we going to debug this?
  • What are the metrics I should take care of?
  • ...

None of the subcommand construction functions return a nil
*cobra.Command, althought this was apparently the case in the past. So
remove the wrapper func and its tests.
@efd6 efd6 added Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team Cleanup skip-changelog labels Mar 20, 2025
@efd6 efd6 self-assigned this Mar 20, 2025
Copy link
Contributor

mergify bot commented Mar 20, 2025

This pull request does not have a backport label. Could you fix it @efd6? 🙏
To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-./d./d is the label that automatically backports to the 8./d branch. /d is the digit
  • backport-active-all is the label that automatically backports to all active branches.
  • backport-active-8 is the label that automatically backports to all active minor branches for the 8 major.
  • backport-active-9 is the label that automatically backports to all active minor branches for the 9 major.

@efd6
Copy link
Contributor Author

efd6 commented Mar 21, 2025

Not sure what backport policy you want with this.

@efd6 efd6 marked this pull request as ready for review March 21, 2025 00:14
@efd6 efd6 requested a review from a team as a code owner March 21, 2025 00:14
@elasticmachine
Copy link
Contributor

Pinging @elastic/elastic-agent-control-plane (Team:Elastic-Agent-Control-Plane)

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

cc @efd6

@pierrehilbert
Copy link
Contributor

I think we can backport this to 8.x but would like @ebeahan's opinion here (or someone from his team).

@swiatekm
Copy link
Contributor

Looks like this was added in #4908 because the otel command didn't work on Windows and the function would return nil, and then removed in #5767. The change looks good to me and we can backport it everywhere, though for this kind of cleanup, main and 8.x are probably the most appropriate.

@swiatekm swiatekm added the backport-8.x Automated backport to the 8.x branch with mergify label Mar 21, 2025
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 Cleanup skip-changelog Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants