From cafdd41afbb096de97358c580f8d43e68f656a42 Mon Sep 17 00:00:00 2001 From: Naveen Gogineni Date: Fri, 1 Dec 2023 08:43:42 -0500 Subject: [PATCH] Remove redundant checks --- command.go | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/command.go b/command.go index d9beb9f6b8..5b41bf9d8c 100644 --- a/command.go +++ b/command.go @@ -1015,9 +1015,6 @@ func hasCommand(commands []*Command, command *Command) bool { } func (cmd *Command) runFlagActions(ctx context.Context) error { - if cmd.flagSet == nil { - return nil - } for _, fl := range cmd.appliedFlags { isSet := false @@ -1042,10 +1039,8 @@ func (cmd *Command) runFlagActions(ctx context.Context) error { if !fl.IsSet() { continue } - if fl.IsSet() { - if pf, ok := fl.(PersistentFlag); ok && pf.IsPersistent() { - continue - } + if pf, ok := fl.(PersistentFlag); ok && pf.IsPersistent() { + continue } }