-
Notifications
You must be signed in to change notification settings - Fork 21
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
Verify key.bin against NodeID in metadata #205
Conversation
cmd/postcli/main.go
Outdated
if cmdVerifyPos(opts, fraction, logger) != nil { | ||
os.Exit(1) | ||
} | ||
os.Exit(0) | ||
cmdVerifyPos(opts, fraction, logger) |
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.
Previously it was clear that the program terminates after calling cmdVerifyPos()
. Now it's hidden and less obvious. How about returning an error
and adding a log.Fatal()
here?
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 don't see the benefit? Errors are not logging messages. I changed the code so it is clear it exits after cmdVerifyPos
is called.
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.
Errors are not logging messages.
? The point of CLI is to communicate to the user the outcome. What's wrong with communicating by showing them a nice readable error message?
I don't see the benefit?
The benefit is that the next person reading this code immediately understands that the program terminates here.
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.
What's wrong with communicating by showing them a nice readable error message?
I did this by updating the errors with your suggestions and printing them directly? Why first wrap them in an error to return them just to print them?
The benefit is that the next person reading this code immediately understands that the program terminates here.
That's why I added the os.Exit(0)
as you suggested?
Closes #198.
Simple verification of the private key in
key.bin
against the NodeID inpostdata_metadata.json
. Will be done when-verify
is set.