Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
//Configuration is a struct which contains all differents type to field
//using parsers on string, time.Duration, pointer, bool, int, int64, time.Time, float64
type Configuration struct {
VersionName string //no description struct tag, it will not be flaged
LogLevel string `short:"l" description:"Log level"` //string type field, short flag "-l"
Timeout time.Duration `description:"Timeout duration"` //time.Duration type field
Db *DatabaseInfo `description:"Enable database"` //pointer type field (on DatabaseInfo)
Owner *OwnerInfo `description:"Enable Owner description"` //another pointer type field (on OwnerInfo)
}
// Sub-structures DatabaseInfo & OwnerInfo are defined on
// https://github.com/cocap10/flaegdemo/blob/master/flaegdemo.go
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment