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

Make flagz be usable with normal flag and spf13/pflag #12

Open
mwitkow opened this issue Mar 26, 2016 · 3 comments
Open

Make flagz be usable with normal flag and spf13/pflag #12

mwitkow opened this issue Mar 26, 2016 · 3 comments

Comments

@mwitkow
Copy link
Owner

mwitkow commented Mar 26, 2016

Currently we're tied to spf13/pflag due to two things.

First, we're using Annotations. It would be trivial to remove them and rely on whether the Value implements Type() and check the prefix for dyn_.

Secondly, and less trivially, the interfaces for pflag.Value and flag.Value don't match, as well as the types of Flag.

https://godoc.org/flag#Flag
https://godoc.org/flag#Value

vs

https://godoc.org/github.com/spf13/pflag#Flag
https://godoc.org/github.com/spf13/pflag#Value

For Dyn* flags, we could achieve complete independence from spf13/pflag vs flag if FlagSet.Var accepted a Value that could be abstracted as common.

However, for monitoring and debug endpoints, we need calls to VisitAll. These return an explicit Flag type that differs between the two.

The second problem can be worked around by just recompiling flagz with s/flag "github.com/spf13/flag"/"flag" ;)

@ldemailly
Copy link

This is done in https://github.com/fortio/dflag

@mwitkow
Copy link
Owner Author

mwitkow commented Feb 12, 2023

Thanks Laurent. Sorry for not being able to maintain this any more actively.

@ldemailly
Copy link

No worries at all, and I am happy I was able to take your great package and further evolve it.
So thank you for making this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants