-
-
Notifications
You must be signed in to change notification settings - Fork 530
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
Encoder reorders arrays in structs #42
Comments
As of now, no, it shouldn't work. And frankly, I hope it never works. It's not specifically clarified in the TOML specification as far as I can tell, but I seem to have declared it invalid with tests in the (If you want to discuss it further in case I'm missing something, I suggest opening a new issue.) |
Oh. Did you mean, should the encoder work with empty table names? Indeed it shouldn't, but it does. Now it doesn't. Fixed in commit 05d026b. |
Thanks. I was trying to use the empty table name as a special name, but after thinking about it found a better solution. I just wasn't sure whether it was allowed with TOML. I can see either behavior acceptable: i.e. empty string is just another value, so it shouldn't be treated differently; vs. you shouldn't use empty table names in configuration, it causes confusion. |
This was actually fixed in commit 44d4af for BurntSushi#43, but this adds a regression test from BurntSushi#42.
The toml.Encoder reorders arrays in structs. I can understand why the main values need to be above, but not why the arrays need to be reordered?
This prints:
Instead of the expected:
(Also, as a side note, I tried to use an empty table name, should it work? e.g.
[servers.]
, to get an entry ofservers: { "": { ... }}
)The text was updated successfully, but these errors were encountered: