Skip to content

Commit

Permalink
Merge pull request #1815 from Juneezee/refactor/redundant-nil-check
Browse files Browse the repository at this point in the history
Remove redundant nil check in `LocalFlagNames`
  • Loading branch information
dearchap committed Oct 11, 2023
2 parents a8de551 + 3da6a64 commit e8abd76
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions command.go
Expand Up @@ -922,11 +922,9 @@ func (cmd *Command) LocalFlagNames() []string {
cmd.flagSet.Visit(makeFlagNameVisitor(&names))

// Check the flags which have been set via env or file
if cmd.Flags != nil {
for _, f := range cmd.Flags {
if f.IsSet() {
names = append(names, f.Names()...)
}
for _, f := range cmd.Flags {
if f.IsSet() {
names = append(names, f.Names()...)
}
}

Expand Down

0 comments on commit e8abd76

Please sign in to comment.