Closed bep closed 2 years ago
Changed in this commit: https://github.com/pelletier/go-toml/pull/755/commits/420c2eb4a2d574a99e43b959ed2bbbece8706354. I did it for consistency between inline tables, array tables, and encoding/json.
[[deployment.targets]]
says that there is a table in an array inside targets
. An other way to write it in TOML is
deployment.targets = [{}]
So those two forms should unmarshal to the same thing. They used not to: array tables created nil maps, inline tables created empty maps. So I had to pick one. The TOML spec says that in JSON this would be equivalent to
{"deployment": {"targets": [{}]}}
Because encoding/json
unmarshals the inner-most object as an empty (non-nil) map, I decided to follow the same pattern – assuming the extra allocation is worth reducing surprises for the programmer.
Does that seem reasonable to you? Is it breaking something in Hugo?
Does that seem reasonable to you? Is it breaking something in Hugo?
I have some config validation checks that no fails, but I will adjust those. Sorry for the noise.
This may be deliberate, but I have some failing tests:
This:
In
toml.Unmarshal
I now get and empty map:Vs before, a nil map:
I'm not sure I have an opinion about what's correct ...