Skip to content

Commit e8abd76

Browse files
authored
Merge pull request #1815 from Juneezee/refactor/redundant-nil-check
Remove redundant nil check in `LocalFlagNames`
2 parents a8de551 + 3da6a64 commit e8abd76

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

command.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -922,11 +922,9 @@ func (cmd *Command) LocalFlagNames() []string {
922922
cmd.flagSet.Visit(makeFlagNameVisitor(&names))
923923

924924
// Check the flags which have been set via env or file
925-
if cmd.Flags != nil {
926-
for _, f := range cmd.Flags {
927-
if f.IsSet() {
928-
names = append(names, f.Names()...)
929-
}
925+
for _, f := range cmd.Flags {
926+
if f.IsSet() {
927+
names = append(names, f.Names()...)
930928
}
931929
}
932930

0 commit comments

Comments
 (0)