Skip to content
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: Fix CLI tools to not print error messages twice #3230

Merged
merged 1 commit into from
Sep 3, 2020

Conversation

tjanez
Copy link
Member

@tjanez tjanez commented Sep 3, 2020

Previously, Execute() called nodeCommon.EarlyLogAndExit() if there was an error running rootCmd.Execute() which in turn printed the error to stderr.

The error message is printed to stdout via github.com/spf13/cobra's ExecuteC() already, so this resulted in the same error message being printed twice.

This is an expansion of f5f906b which fixed this behavior for go/oasis-test-runner/cmd.

Closes #3048.

Previously, Execute() called nodeCommon.EarlyLogAndExit() if there was
an error running rootCmd.Execute() which in turn printed the error to
stderr.
The error message is printed to stdout via github.com/spf13/cobra's
ExecuteC() already, so this resulted in the same error message being
printed twice.

This is an expansion of f5f906b which
fixed this behavior for go/oasis-test-runner/cmd.
@codecov
Copy link

codecov bot commented Sep 3, 2020

Codecov Report

Merging #3230 into master will increase coverage by 0.24%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3230      +/-   ##
==========================================
+ Coverage   67.50%   67.75%   +0.24%     
==========================================
  Files         370      370              
  Lines       36379    36379              
==========================================
+ Hits        24559    24649      +90     
+ Misses       8637     8560      -77     
+ Partials     3183     3170      -13     
Impacted Files Coverage Δ
go/oasis-node/cmd/root.go 87.17% <0.00%> (ø)
go/consensus/tendermint/api/api.go 77.65% <0.00%> (-9.58%) ⬇️
go/worker/storage/service_external.go 57.35% <0.00%> (-2.95%) ⬇️
go/control/api/grpc.go 57.00% <0.00%> (-1.87%) ⬇️
go/runtime/host/sandbox/sandbox.go 66.54% <0.00%> (-1.49%) ⬇️
go/storage/mkvs/checkpoint/checkpointer.go 66.17% <0.00%> (-1.48%) ⬇️
go/runtime/host/protocol/connection.go 62.93% <0.00%> (-0.39%) ⬇️
go/storage/metrics.go 85.13% <0.00%> (ø)
go/storage/client/client.go 70.53% <0.00%> (ø)
go/consensus/tendermint/apps/staking/staking.go 54.67% <0.00%> (ø)
... and 23 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9d1f222...5cbdac6. Read the comment docs.

@tjanez tjanez merged commit 704821d into master Sep 3, 2020
@tjanez tjanez deleted the tjanez/cli-dont-print-errors-twice branch September 3, 2020 11:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consider replacing EarlyLogAndExit() in CLI commands
2 participants