Skip to content

Instantly share code, notes, and snippets.

@cocap10
Last active August 4, 2016 15:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cocap10/bbd5672a81175e07492c6c9e7b43aba7 to your computer and use it in GitHub Desktop.
Save cocap10/bbd5672a81175e07492c6c9e7b43aba7 to your computer and use it in GitHub Desktop.
//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