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

.Scratch.Add with typed slice ([]int) to untyped slice ([]interface{}) fails #5275

Closed
bep opened this issue Oct 2, 2018 · 2 comments · Fixed by #5295
Closed

.Scratch.Add with typed slice ([]int) to untyped slice ([]interface{}) fails #5275

bep opened this issue Oct 2, 2018 · 2 comments · Fixed by #5295
Assignees
Milestone

Comments

@bep
Copy link
Member

bep commented Oct 2, 2018

Related to #5269

See https://discourse.gohugo.io/t/updating-from-v0-48-to-v0-49-broke-build/14519/4?u=bep

Probably refactor the append logic in tpl and move that to a commons package and reuse.

@bep bep added the Bug label Oct 2, 2018
@bep bep added this to the v0.49.1 milestone Oct 2, 2018
@bep bep self-assigned this Oct 2, 2018
@bep bep changed the title Check .Scratch.Append vs slice Check .Scratch.Add vs slice Oct 2, 2018
@bep bep modified the milestones: v0.49.1, v0.50 Oct 6, 2018
@bep bep changed the title Check .Scratch.Add vs slice .Scratch.Add with typed slice ([]int) to untyped slice ([]interface{}) fails Oct 8, 2018
@bep
Copy link
Member Author

bep commented Oct 8, 2018

Note: This has always been an issue, but it is the slice method that has gotten more "type aware" in Hugo 0.49. The example used in the forum isn't very common, though, but we should improve this.

bep added a commit to bep/hugo that referenced this issue Oct 8, 2018
bep added a commit to bep/hugo that referenced this issue Oct 8, 2018
bep added a commit to bep/hugo that referenced this issue Oct 8, 2018
bep added a commit to bep/hugo that referenced this issue Oct 8, 2018
This commit consolidates the reflective collections handling in `.Scratch` vs the `tpl` package so they use the same code paths.

This commit also adds support for a corner case where a typed slice is appended to a nil or empty `[]interface{}`.

Fixes gohugoio#5275
@bep bep closed this as completed in #5295 Oct 8, 2018
bep added a commit that referenced this issue Oct 8, 2018
This commit consolidates the reflective collections handling in `.Scratch` vs the `tpl` package so they use the same code paths.

This commit also adds support for a corner case where a typed slice is appended to a nil or empty `[]interface{}`.

Fixes #5275
@bep bep modified the milestones: v0.50, v0.49.1 Oct 10, 2018
bep added a commit that referenced this issue Oct 10, 2018
This commit consolidates the reflective collections handling in `.Scratch` vs the `tpl` package so they use the same code paths.

This commit also adds support for a corner case where a typed slice is appended to a nil or empty `[]interface{}`.

Fixes #5275
@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant