pelletier / go-toml

Go library for the TOML file format
https://github.com/pelletier/go-toml
Other
1.67k stars 208 forks source link

Decode: unstable/Unmarshal interface #940

Closed rszyma closed 3 months ago

rszyma commented 3 months ago

This adds the Unmarshaler interface to the v2 package. This way types that implement this interface can define the way they are unmarshalled.

Attempts to fix #873
Supersedes #921

rszyma commented 3 months ago

there are still arrays and tables left to be implemented properly

pelletier commented 3 months ago

Thank you for pushing this! Sorry, it took me a while to review.

I've confirmed there is no performance regression when the feature is disabled (by default), as expected. I'll push a commit on this branch to warn people of the state of the feature and it should be good to be merged.