-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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
Collection key type in YAML breaks map range order #4083
Comments
I came across another issue with this behaviour.
|
I assume this is a |
Duplicate of #2441 |
Recurse through result of yaml package parsing and change all maps from map[interface{}]interface{} to map[string]interface{} making them jsonable and sortable. Fixes gohugoio#2441, gohugoio#4083
Recurse through result of yaml package parsing and change all maps from map[interface{}]interface{} to map[string]interface{} making them jsonable and sortable. Fixes gohugoio#2441, gohugoio#4083
Recurse through result of yaml package parsing and change all maps from map[interface{}]interface{} to map[string]interface{} making them jsonable and sortable. Fixes gohugoio#2441, gohugoio#4083
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. |
When defining a collection in Hugo data file using YAML format it is then parsed as
map[interface {}]interface {}
. This fundamentally differs from TOML and JSON which parses collections tomap[string]interface {}
.Example (YAML):
is parsed to:
Example (TOML):
is parsed to:
Example (JSON):
is parsed to:
As YAML is a superset of JSON one can suppose the same key type in both formats.
The following have a great effect on ranging over maps. From the range docs:
Apparently
string
is comparable, unlikeinterface{}
.The text was updated successfully, but these errors were encountered: