-
Notifications
You must be signed in to change notification settings - Fork 501
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
fix: Fix fromJson template function deserializing non-objects #3380
Conversation
if err := chezmoi.FormatJSONC.Unmarshal([]byte(s), &value); err != nil { | ||
panic(err) | ||
} | ||
return value | ||
} | ||
|
||
func (c *Config) fromTomlTemplateFunc(s string) any { | ||
var value map[string]any | ||
var value any |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that TOML allows anything but a dictionary at the root, so this is probably fine as it was.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Fixed in e68328e.
if err := chezmoi.FormatTOML.Unmarshal([]byte(s), &value); err != nil { | ||
panic(err) | ||
} | ||
return value | ||
} | ||
|
||
func (c *Config) fromYamlTemplateFunc(s string) any { | ||
var value map[string]any | ||
var value any |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is probably a good thing as
- 1
- 2
- 3
is a thing.
This does fix the test case. |
Fixes #3379.