var Flags … // CopyFlags ensures that all flags that are defined in the source flag // set appear in the target flag set as if they had been defined there // directly. From the flag package it inherits the behavior that there // is a panic if the target already contains a flag from the source. func CopyFlags(source *flag.FlagSet, target *flag.FlagSet) { … } // AddOptions analyzes the options value and creates the necessary // flags to populate it. // // The prefix can be used to root the options deeper in the overall // set of options, with a dot separating different levels. // // The function always returns true, to enable this simplified // registration of options: // _ = AddOptions(...) // // It panics when it encounters an error, like unsupported types // or option name conflicts. func AddOptions(options interface{ … } // AddOptionsToSet is the same as AddOption, except that it allows choosing the flag set. func AddOptionsToSet(flags *flag.FlagSet, options interface{ … } func addStructFields(flags *flag.FlagSet, structType reflect.Type, structValue reflect.Value, prefix string) { … } // parseDefault is necessary because "flag" wants the default in the // actual type and cannot take a string. It would be nice to reuse the // existing code for parsing from the "flag" package, but it isn't // exported. func parseDefault(value interface{ … }