Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
go/oasis-test-runner: List all available scenarios #3044
go/oasis-test-runner: List all available scenarios #3044
Changes from all commits
83134c2
f5f906b
669b335
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Why this change?
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.
The
nodeCommon.EarlyLogAndExit()
prints the error to stderr:oasis-core/go/oasis-node/cmd/common/common.go
Lines 79 to 86 in ffa5454
which results in the same error message being outputted twice.
For example:
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.
Who prints the first error message, does cobra do that internally?
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.
Yes, Cobra does that in
ExecuteC()
: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 like our helper better as it prints to stderr while cobra seems to print to stdout? Could we instead set
SilenceErrors
(maybe this needs to be done in other places as well as we useEarlyLogAndExit
everywhere)?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.
Cobra's
Command.Println()
defaults to printing to stderr.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.
Why do we have this
EarlyLogAndExit
at all then?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 guess it is still useful for cases where we want to exit and print an error before we execute Cobra's
Execute()
.I found two such cases in
go/oasis-test-runner
:oasis-core/go/oasis-test-runner/test-runner.go
Line 26 in ffa5454
oasis-core/go/oasis-test-runner/cmd/root.go
Line 550 in f5f906b
I've removed other uses in
go/oasis-test-runner
.For other parts of the code base, I can file an issue to systematically check that.
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.
Done: #3048.