From b48371a62f7beed42eadc9b719ea4f059aa24ef2 Mon Sep 17 00:00:00 2001 From: Sebastiaan Pasterkamp <26205277+SebastiaanPasterkamp@users.noreply.github.com> Date: Sun, 5 Jun 2022 17:54:46 +0200 Subject: [PATCH] Simplify sub-command initialization w/o IgnoreDefault --- parse.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/parse.go b/parse.go index 9f93502..a883a10 100644 --- a/parse.go +++ b/parse.go @@ -531,7 +531,7 @@ func (p *Parser) process(args []string) error { // instantiate the field to point to a new struct v := p.val(subcmd.dest) - if !p.config.IgnoreDefault || v.IsNil() { + if v.IsNil() { v.Set(reflect.New(v.Type().Elem())) // we already checked that all subcommands are struct pointers }