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

Support Unmarshal into empty interface{} #432

Closed
moorereason opened this issue Aug 19, 2020 · 1 comment · Fixed by #433
Closed

Support Unmarshal into empty interface{} #432

moorereason opened this issue Aug 19, 2020 · 1 comment · Fixed by #433
Assignees
Labels
feature Issue asking for a new feature in go-toml.

Comments

@moorereason
Copy link
Contributor

Is your feature request related to a problem? Please describe.
While looking at migrating Hugo from BurntSushi to this package, I found that this package doesn't support unmarshaling into an empty interface{}. Returns an error "only a pointer to struct or map can be unmarshaled from TOML."

Describe the solution you'd like
When an empty interface{} is passed to toml.Unmarshal as the v parameter, decode as a map[string]interface{}.

Describe alternatives you've considered
Stick with BurntSushi. 😞

Additional context

@pelletier pelletier added the feature Issue asking for a new feature in go-toml. label Aug 19, 2020
@pelletier
Copy link
Owner

Totally right, go-toml should be able to do that. At that point I don't see any blocker to support it -- except finding the time to actually do the work.

@AllenX2018 AllenX2018 self-assigned this Aug 28, 2020
pelletier added a commit that referenced this issue Sep 11, 2020
Allows to marshal a TOML document into an empty `interface{}`, resulting
in a `map[string]interface{}`.

Fixes #432
pelletier added a commit that referenced this issue Sep 11, 2020
Allows to marshal a TOML document into an empty `interface{}`, resulting
in a `map[string]interface{}`.

Fixes #432
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Issue asking for a new feature in go-toml.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants