func ExampleSetup(t *testing.T) { // make a config var to hold some flags var Config struct { Value int `default:"20" usage:"this is some value"` Time time.Duration `default:"10s" usage:"some duration"` What string `default:"such a string" usage:"quite the string"` } // this creates flags with names // prefix.value // prefix.time // prefix.what utils.Setup("prefix", &Config) // this loads the flags into config. flagfile automatically adds a flag // named flagfile, which when specified will load the key/value pairs in // that file as if they were specified on the command line. flagfile.Load() }
func init() { utils.Setup("log", &config) }
// Setup is a deprecated wrapper around flagfile/utils.Setup // http://godoc.org/github.com/spacemonkeygo/flagfile/utils#Setup func Setup(prefix string, x interface{}) { utils.Setup(prefix, x) }