add further comment about backwards-compatible method for setting default values

This commit is contained in:
Alex Flint 2022-10-29 15:13:57 -04:00
parent 9d5e97ac8a
commit d949871b67
1 changed files with 2 additions and 0 deletions

View File

@ -210,6 +210,8 @@ func NewParser(config Config, dests ...interface{}) (*Parser, error) {
}
// for backwards compatibility, add nonzero field values as defaults
// this applies only to the top-level command, not to subcommands (this inconsistency
// is the reason that this method for setting default values was deprecated)
for _, spec := range cmd.specs {
// get the value
v := p.val(spec.dest)