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
logs: add AddGoFlags #114731
logs: add AddGoFlags #114731
Conversation
@pohly: This issue is currently awaiting triage. If a SIG or subproject determines this is a relevant issue, they will accept it by applying the The Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/test pull-kubernetes-unit |
This is useful for binaries that don't use pflag and cannot migrate to it because they have to support the traditional single-dash command line parsing. pflag is a drop-in replacement at the source code level, but the behavior of flag parsing in the resulting binary is different.
TestFlags got superseded by TestFlagSet/pflag in 8251a63.
4d43fec
to
6f3e5e3
Compare
/lgtm |
LGTM label has been added. Git tree hash: cb1a56814c50ecedfed2fa80790127229c0deb9e
|
This PR may require API review. If so, when the changes are ready, complete the pre-review checklist and request an API review. Status of requested reviews is tracked in the API Review project. |
/assign @thockin For approval. Needed for #114843 (review) and kubernetes-csi/node-driver-registrar#259. |
Is there a canonical example of what a best-practice, no-baggage, max-leverage, no-BS component's There are so many public functions here now, I can't keep track of who calls what, and what I am supposed to do - what is the north star (is that hemispherist?) ? |
The canonical example is https://github.com/kubernetes/component-base/blob/master/logs/example/cmd/logger.go. It uses cobra + pflags. There's no example for Go with just the stdlib (yet) - I could add one. |
I'd love to see an example that shows canonical use with a small set of options, not just logging but all of the "facilities" available to a "kube component". That example helps some - still seems like some boilerplate that could be trimmed, but I only looked superficially :) /approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: pohly, serathius, thockin The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What type of PR is this?
/kind feature
What this PR does / why we need it:
This makes it possible to use logging command line flags with a flag.FlagSet, without having to copy values from a pflag.FlagSet.
Does this PR introduce a user-facing change?