-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Fix --output-document flag #8121
Conversation
@amaurymartiny -> #8122 - please take a look |
handle deferred io.WriterCloser.Close() calls
@@ -60,11 +60,11 @@ account key. It implies --signature-only. | |||
} | |||
|
|||
func makeSignBatchCmd() func(cmd *cobra.Command, args []string) error { |
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.
This function is wayyyy to large for naked returns. If using named return value(s), please avoid naked returns and explicitly return the value(s).
Co-authored-by: Alessio Treglia <alessio@tendermint.com>
Co-authored-by: Alessio Treglia <alessio@tendermint.com>
I've made a couple of corrections @alexanderbez. The naked returns allow the function to return the error returned by a - (There is an excellent article that illustrates the pattern that I used and its rationale: https://www.joeshaw.org/dont-defer-close-on-writable-files/#:~:text=But%20this%20idiom%20is%20actually,infrequent%2C%20maddening%20bugs%20will%20occur.) |
I do not understand. It's as simple as |
@amaurymartiny I had a chat with bez. My code suggestions should both just work and make him happy |
Co-authored-by: Alessio Treglia <alessio@tendermint.com>
Co-authored-by: Alessio Treglia <alessio@tendermint.com>
Co-authored-by: Alessio Treglia <alessio@tendermint.com>
Co-authored-by: Alessio Treglia <alessio@tendermint.com>
Co-authored-by: Alessio Treglia <alessio@tendermint.com>
Co-authored-by: Alessio Treglia <alessio@tendermint.com>
Co-authored-by: Alessio Treglia <alessio@tendermint.com>
Co-authored-by: Alessio Treglia <alessio@tendermint.com>
Co-authored-by: Alessio Treglia <alessio@tendermint.com>
Weird error |
x/auth/client/cli/cli_test.go
Outdated
s.Require().NoError(err) | ||
defer func() { | ||
err = os.Remove(tempfile.Name()) | ||
s.Require().NoError(err) |
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.
This may cause the test to fail if the temporary file is not deleted successfully at the end of the test (which might happen for a number of reasons that are entirely unrelated to the test case itself)
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.
ah, what are best practices here? should I just ignore the err?
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 do not know if I agree with this. I would keep this as-is. If it errors, so be it. Just rerun the test. Ignoring errors in tests is typically not something you want to do.
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.
This is about the removal of a temporary file that is created within the execution of a test. If we want to go for The Right Way(c), then yes we might want to cause the test fail. Though weird things happen in a CI that we don't fully control, e.g. resources might become unavailable before the program exits. In my opinion, it'd just be a self-inflicted pain in the lower back if we had to go and manually re-run all tests because of a glitch in the CI. Thus we should just ignore the error and let go.
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.
Solved with #8121 (comment), I guess.
…os-sdk into am-8109-fix-output-doc
OK i realized that @robert-zaremba already fixed this in #8106. Talked offline with Robert, i'll close this and let's continue there. |
Description
ref: #8109
Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.
docs/
) or specification (x/<module>/spec/
)godoc
comments.Unreleased
section inCHANGELOG.md
Files changed
in the Github PR explorerCodecov Report
in the comment section below once CI passes