forked from go-debos/debos
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reverse the exitcode initialization value
Fakemachine is subject to panic and causes Debos to exit success due to the current logic of the exitcode. For example, the fakemachine function CopyFileTo() panics if the file is missing. In the case of a panic, the function never returns. Thus, the exitcode cannot be set to 1 and Debos exits with 0. This commit reverses the logic of the exitcode: it is initialized to 1 (i.e. failure), and it is set to 0 (i.e. success) only if Debos has reached the end of the things it has to do (or for the help message). Signed-off-by: Gaël PORTAY <[email protected]>
- Loading branch information
1 parent
2e004a2
commit d0f1d97
Showing
1 changed file
with
15 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 comment
on commit d0f1d97
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.
Might want to amend the patch and reinstate Gaël as author, unless you've made substantial changes. If so, add a small note/summary in the commit message.
With the authorship fixed, regardless of the style suggestion, this patch is
Reviewed-by: Emil Velikov <[email protected]>
Nit: personally I'm a fan of using a "happy" path and avoiding the else-after-return statements - see example below. Note that gofmt is the king dictating the formatting, take its suggestion with higher priority than mine.
Example: