Users get tripped up when accidentally mix & matching
Cobra's `Flags()` and `PersistentFlags()`, where they will
call `Lookup(<flag>)` on the wrong flagset.
Following the README, users would call `Lookup` to fill in
the flag source parameter of Viper's `BindPFlag`, but by
using the wrong flagset, the parameter would simply be nil.
This would then result in a runtime panic whenever trying
to retrieve the flag's value with `Get(<flag>)`.
This work alleviates the mistake by:
+ Performing a nil check in `BindPFlag` and causing
`BindFlagValue` to return an error if the parameter
flag is nil, as it would be during the expected mixup.
+ Updating the godoc of `BindPFlag` and the README's example,
to drill the fact that `Flags` and `PersistentFlags` are
different flagsets.
+ Adding a test for this pattern of binding nil on accident
and then retrieving flags. Before these changes, this test
would panic. Now, the test instead gracefully errors and
applies no changes to the viper instance.
Fixes#71, #93, #158, #168, #209, #141, #160, #162, #190
* Fixed: indentation in comment
* Fixed: Get() returns nil when nested element not found
* Fixed: insensitiviseMaps() made recursive so that nested keys are lowercased
* Fixed: order of expected<=>actual in assert.Equal() statements
* Fixed: find() looks into "overrides" first
* Fixed: TestBindPFlags() to use a new Viper instance
* Fixed: removed extra aliases from display in Debug()
* Added: test for checking precedence of dot-containing keys.
* Fixed: Set() and SetDefault() insert nested values
* Added: tests for overriding nested values
* Changed: AllKeys() includes all keys / AllSettings() includes overridden nested values
* Added: test for shadowed nested key
* Fixed: properties parsing generates nested maps
* Fixed: Get() and IsSet() work correctly on nested values
* Changed: modifier README.md to reflect changes
* Change the order to "JSON, TOML and YAML" because that is
the order that Viper attempts to find the config file,
as listed in SupportedExts string array
* Rename "Indexes" to "Taxonomies" (re: Hugo)
* GitHub now forces https, so update GitHub URLs accordingly
* Add links to Wikipedia pages about Viper and Cobra Commander
in case the users do not know the G.I. Joe reference
* Other minor copyediting