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

Rewrite TomlTree encoding #133

Merged
merged 4 commits into from
Mar 2, 2017
Merged

Rewrite TomlTree encoding #133

merged 4 commits into from
Mar 2, 2017

Conversation

pelletier
Copy link
Owner

@pelletier pelletier commented Mar 2, 2017

Notable changes:

  • Encoding makes the assumption that the tree is well formed, meaning that it is only composed of those types for leaf nodes: string, int64, uint64, float64, bool, time.Time, [] of any of this list; and those for intermediate nodes: *tomlValue, *tomlTree, []*TomlTree. This allows for a great deal of simplification in the encoding code, as well as saner logic. The caveat is that TreeFromMap() currently does not perform any sanitization. I'm planning on implementing that in subsequent changes, but in the meantime the tree should be properly constructed using Set().
  • Encoding sorts keys by alphabetical order.
  • tomltree_conversions*.go files are now tomltree_write*.go.
  • A new method, tree.WriteTo(io.Writer) (int64, error) is now available, for all the encoding needs.

@tgulacsi this is loosely based on your #123. Thanks for the work and support!

@tgulacsi
Copy link

tgulacsi commented Mar 2, 2017

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants