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

After should accept 0 as an index #6388

Closed
gnalck opened this issue Oct 4, 2019 · 1 comment · Fixed by #6413
Labels
Milestone

Comments

@gnalck
Copy link

@gnalck gnalck commented Oct 4, 2019

Issue Description

Currently after blows up if you pass in 0 as the index, which feels like a valid usage that should not crash things. The line that causes this is here.

If this gets maintainer approval I'm happy to make the change myself, given that its only a line or two :).

What version of Hugo are you using (hugo version)?

$ hugo version
Hugo Static Site Generator v0.58.1-24277B92 linux/amd64 BuildDate: 2019-09-06T09:19:04Z

Does this issue reproduce with the latest release?

Yes

@bep bep added this to the v0.59 milestone Oct 4, 2019
@bep bep added the Enhancement label Oct 4, 2019
@bep

This comment has been minimized.

Copy link
Member

@bep bep commented Oct 4, 2019

If this gets maintainer approval I'm happy to make the change myself,

Approved, but please also add a test case.

BaibhaVatsa added a commit to BaibhaVatsa/hugo that referenced this issue Oct 11, 2019
Modified the if conditional because of which after threw an error if called with 0 as index. The function now returns the whole original slice if 0 is passed as an index. Also added tests to test the new behavior.

Fixes gohugoio#6388
@bep bep closed this in #6413 Oct 11, 2019
bep added a commit that referenced this issue Oct 11, 2019
Modified the if conditional because of which after threw an error if called with 0 as index. The function now returns the whole original slice if 0 is passed as an index. Also added tests to test the new behavior.

Fixes #6388
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.