-
Notifications
You must be signed in to change notification settings - Fork 20.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cmd/utils/flags.go: Applying a String len guard for the gitCommit param of the NewApp() #15790
Conversation
Thank you for your contribution! Your commits seem to not adhere to the repository coding standards
Please check the contribution guidelines for more details. This message was auto-generated by https://gitcop.com |
…am of the NewApp()
f3d7750
to
89be5f7
Compare
cmd/utils/flags.go
Outdated
@@ -96,7 +96,7 @@ func NewApp(gitCommit, usage string) *cli.App { | |||
//app.Authors = nil | |||
app.Email = "" | |||
app.Version = params.Version | |||
if gitCommit != "" { | |||
if gitCommit != "" && len(gitCommit) >= 8 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can drop the gitCommit != ""
part, len(gitCommit) >= 8
already validates that it's not ""
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…#15790) * cmd/utils/flags.go: Applying a String len guard for the gitCommit param of the NewApp() * cmd/utils: remove redundant clause in if condition
…#15790) * cmd/utils/flags.go: Applying a String len guard for the gitCommit param of the NewApp() * cmd/utils: remove redundant clause in if condition
…thereum#15790) * cmd/utils/flags.go: Applying a String len guard for the gitCommit param of the NewApp() * cmd/utils: remove redundant clause in if condition
Just a simple guard to match the check-case of [1]. Seems that for some applications, people are trying to sneak in the git-tag (version) of theirs, rather than an actual commit hash. This is only to protect them.
[1] https://github.com/ethereum/go-ethereum/blob/master/params/version.go#L41