-
Notifications
You must be signed in to change notification settings - Fork 24
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
refactor(main): simplify defaultAction
#896
Conversation
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.
Thanks for your contribution
Btw why should this function return an error, as i don't see any a scenario where
Action
ofcli.Command
returns an error for help command.
app.Action
has the type cli.ActionFunc
which is func(*Context) error
.
scalingo/main.go
Outdated
break | ||
} | ||
} | ||
if len(os.Args)-2 > 0 { |
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.
I find this condition more readable the following way. Moreover, I think a comment should be added to explain the reason of both these if
instructions.
if len(os.Args)-2 > 0 { | |
if len(os.Args) > 2 { |
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.
Thank you for reviewing my pull request. I received your request to add a code comment, but I'm not entirely sure what to write.
I know how important it is to have clear and concise code comments. I was wondering if you have any specific suggestions on what kind of information I should include in the comment.
Thank you for your help, and I look forward to hearing back from you soon.
defaultAction
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.
I was wondering if you have any specific suggestions on what kind of information I should include in the comment.
After reading your PR again, I actually think that the code is readable "as is" and do not require an extra comment. Sorry for my previous review and thanks again for your contribution! 👏
d7c0871
to
a5ac4f4
Compare
a5ac4f4
to
8728028
Compare
Cannot execute CodeShip due to external contribution. Manually executed both tests and linters:
|
Should we add an entry even if it small refacto ?
The purpose of this PR is only to refacto the DefaultAction function with less lines.
Btw why should this function return an error, as i don't see any a scenario where
Action
ofcli.Command
returns an error for help command.In the futur, shouldn’t we change the signature of
type ActionFunc func(*Context) error
inCommand
struct since every function just exit and none of them returns an error.