-
Notifications
You must be signed in to change notification settings - Fork 18
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
"readability"fix(store): Clearer range check #227
base: main
Are you sure you want to change the base?
Conversation
Can you add following lines to the
(at the end of the test, to prevent any regressions in the future) |
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 but see comment regarding a few asserts
1
to be requested from the storeThere 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, thanks!
// `from` with `to-1` | ||
if from > to-1 { | ||
return nil, fmt.Errorf("header/store: invalid range(%d,%d)", from, to-1) | ||
if from >= to { |
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.
Did we check this on Exchange?
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.
from > to-1
is the same as from >= to
, but it's tricky to understand. The new version is much easier to follow.
This PR cleans up a sanity check on the range request in the private method of store to make it more readable.