naoina / toml

TOML parser and encoder library for Golang
MIT License
294 stars 50 forks source link

add UnmarshallFile convenience method #4

Closed flowchartsman closed 9 years ago

flowchartsman commented 9 years ago

If the most common use case is to read in the file and parse it, seems like a convenience method is a good idea.

fern4lvarez commented 9 years ago

Is it that hard to use the code from the example, using the basic Unmarshal function, and not to bloat the public API? Also, some people might want to open the file in a different way.

More comments:

flowchartsman commented 9 years ago

Is it hard? Absolutely not. As I say, it's just a convenience method.

I absolutely agree that people might want to open the file a different way, but I'd wager the majority of use cases will just be opening a text file on disk.

That said, it's your library, you're completely free to reject this pull request outright, or reject it and implement it yourself, and it would cause me no hard feelings whatsoever. I'll go ahead and push the changes you suggest, and you can do what you think is best!

naoina commented 9 years ago

I added Encoder and Decoder like encoding/json. You can use these APIs. I think it is good enough.

flowchartsman commented 9 years ago

Works for me!

fern4lvarez commented 9 years ago

Hey @alaska, this is not my library, just a humble user giving some feedback to your PR ☺️

Glad that you came up with a workaround!