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

hugolib: Cast taxonomy weight parameters to int #5279

Merged
merged 2 commits into from
Oct 3, 2018

Conversation

moorereason
Copy link
Contributor

Fixes #4628

hugolib/site_test.go Show resolved Hide resolved
hugolib/site.go Outdated

weight, err := cast.ToIntE(p.getParamToLower(plural + "_weight"))
if err != nil {
s.Log.ERROR.Print("unable to convert taxonomy weight to int")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: Start message with upper case?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also print out the actual taxonomy weight (using %#v I think?) so that the user knows which exact taxonomy weight couldn't get casted.

Would it be possible to print the path of the offending file containing the uncastable taxonomy weight too?

Error is now "Unable to convert taxonomy weight []string{"40"} to int
for variables/files.md"
@bep
Copy link
Member

bep commented Oct 3, 2018

Has the Hacktoberfest started? I like it (note that you need to register somewhere to get the free t-shirt).

@bep bep merged commit d3b81ee into gohugoio:master Oct 3, 2018
@moorereason moorereason deleted the iss4628 branch December 17, 2020 18:20
@github-actions
Copy link

This pull request 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 Jan 14, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Panic on zero-padded taxonomy weights
3 participants