jessevdk/go-flags — pull request #54 by iancmcc (2014-01-09 16:08:38+00:00)
Title: Add IgnoreDefaults option to allow the parser to avoid storing defaults

I needed the defaults to be included when writing out the help text, and they needed to be applied, but _after_ values had been filled in from another source. That is, priority was Command Line > Config File > Defaults. The only way I could figure out how to accomplish this was to parse with no arguments (to get the defaults struct), parse the command line options (with the IgnoreDefaults parser option provided by this pull request), parse the config file (using an option from the command line), then merge the structs in the correct order. Without IgnoreDefaults, I would have no way of knowing what got parsed and what was a default.

Maybe there's a better way to do this, but it's working well for me.