urfave / cli

A simple, fast, and fun package for building command line apps in Go
https://cli.urfave.org
MIT License
21.91k stars 1.69k forks source link

Remove redundant nil check in `LocalFlagNames` #1815

Closed Juneezee closed 8 months ago

Juneezee commented 9 months ago

What type of PR is this?

What this PR does / why we need it:

From the Go specification:

"1. For a nil slice, the number of iterations is 0." https://go.dev/ref/spec#For_range

Therefore, an additional nil check for before the loop is unnecessary. Example: https://go.dev/play/p/_cXfzMOvMm3

Testing

go test ./...
?       github.com/urfave/cli/v3/internal/build [no test files]
?       github.com/urfave/cli/v3/internal/example-cli   [no test files]
?       github.com/urfave/cli/v3/internal/example-hello-world   [no test files]
ok      github.com/urfave/cli/v3    0.101s

Release Notes

NONE
github-actions[bot] commented 8 months ago
[![](https://raw.githubusercontent.com/jfrog/frogbot/master/resources/v2/noVulnerabilityBannerPR.png)](https://github.com/jfrog/frogbot#readme)

**Frogbot** also supports **Contextual Analysis, Secret Detection and IaC Vulnerabilities Scanning**. This features are included as part of the [JFrog Advanced Security](https://jfrog.com/xray/) package, which isn't enabled on your system.

[🐸 JFrog Frogbot](https://github.com/jfrog/frogbot#readme)