-
-
Notifications
You must be signed in to change notification settings - Fork 7.7k
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
Last should accept 0 as limit #6419
Labels
Milestone
Comments
I agree. I labeled this as an Enhancement, as I guess there are test cases for it. But you are right, what you say makes much more sense. |
BaibhaVatsa
added a commit
to BaibhaVatsa/hugo
that referenced
this issue
Oct 11, 2019
Modified the if conditional because of which last threw an error if 0 was passed as limit. The function now returns an empty slice if it is called with 0 as limit. The behavior of first and last is now the same when 0 is passed as limit. Also added tests to test the new behavior. Fixes gohugoio#6419
bep
pushed a commit
that referenced
this issue
Oct 11, 2019
Modified the if conditional because of which last threw an error if 0 was passed as limit. The function now returns an empty slice if it is called with 0 as limit. The behavior of first and last is now the same when 0 is passed as limit. Also added tests to test the new behavior. Fixes #6419
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Issue description
Currently, Last if 0 is passed as a limit even though that usage should not crash things.
Further, as a value for limit and returns an empty slice in that case so for consistency last should also accept 0 as limit.
What version of Hugo are you using (
hugo version
)?Does this issue reproduce with the latest release?
Yes
The text was updated successfully, but these errors were encountered: