-
Notifications
You must be signed in to change notification settings - Fork 713
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
Fixes to example tools #465
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.
0 means success, and 1 means a failure. Do we want Exit(0) here? @kozlovic any opinion?
I think we should exit 0 at least in the case for when only showing help, then exit 1 on incorrect usage. I could add an |
ok I agree. |
7cb28c8
to
a6206ce
Compare
Applied updates to the tools so that:
|
examples/nats-bench/main.go
Outdated
@@ -37,6 +37,10 @@ const ( | |||
func usage() { | |||
log.Printf("Usage: nats-bench [-s server (%s)] [--tls] [-np NUM_PUBLISHERS] [-ns NUM_SUBSCRIBERS] [-n NUM_MSGS] [-ms MESSAGE_SIZE] [-csv csvfile] <subject>\n", nats.DefaultURL) | |||
flag.PrintDefaults() | |||
} | |||
|
|||
func showUsageAndDie() { |
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.
Maybe ShowUsageAndExit(exitcode int)
?
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.
sounds good to me, just updated
Signed-off-by: Waldemar Quevedo <[email protected]>
a6206ce
to
eabeb89
Compare
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
Apply similar fix as #456 and call exit 1 after showing the tool usage/help message.
Signed-off-by: Waldemar Quevedo [email protected]