-
-
Notifications
You must be signed in to change notification settings - Fork 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
commands: fix opt.Description panic when desc was empty #3521
Conversation
:):) LGTM |
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.
Change LGTM as is, but i suggested a tweak that improves the code style in general
@@ -43,6 +43,9 @@ func (o *option) Type() reflect.Kind { | |||
} | |||
|
|||
func (o *option) Description() string { | |||
if len(o.description) == 0 { | |||
return "" | |||
} | |||
if o.description[len(o.description)-1] != '.' { |
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.
We can change this to:
if !strings.HasSuffix(o.description, ".") {
o.description += "."
}
License: MIT Signed-off-by: Jakub Sztandera <[email protected]>
00fac9a
to
591e826
Compare
@whyrusleeping should be good for merge |
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, thanks
Resolves #3520
License: MIT
Signed-off-by: Jakub Sztandera [email protected]