pflag
pflag copied to clipboard
Support importing existing flag package flags
This is important for packages (like https://github.com/golang/glog) where the flags are embedded deeply into the code.
I already have this supported in kubernetes here that we can borrow/steal: https://github.com/GoogleCloudPlatform/kubernetes/blob/master/pkg/util/plog_import.go
(I typo'd the name of that file and I'll fix it up soon).
This would be a lot easier if the pflag.Value.Type
didn't exist or was an extended optional interface. It is unclear why that is there and where it is used.
pflag.Value.Type
isn't something I'm aware of. I think this is something @spf13 added, but adding methods to Go interfaces is a pretty strong backwards incompatibility because it can make existing types no longer satisfy interfaces they expect to.
I agree that this should be an additional optional interface if it exists at all.