lytics/confl

Why not follow the encoding/* conventions?

tv42 opened this issue · 2 comments

tv42 commented

encoding/json and friends have an API in the style of

func Marshal(val interface{}) ([]byte, error)
func Unmarshal(data []byte, v interface{}) error

func NewEncoder(w io.Writer) *Encoder
func (enc *Encoder) Encode(v interface{}) error

func NewDecoder(r io.Reader) *Decoder
func (dec *Decoder) Decode(v interface{}) error

Where "decode" means streaming operations and "marshal" operates on []byte.

Why not follow that? Right now, the confl API seems unlike good Go, and especially Decode taking a string comes off as very weird.

Apart from that, looks good. I've been wanting something like this for a while, and while https://github.com/hashicorp/hcl also looked promising, it seems confl integrates with the Go style of unmarshaling into a struct better.

Good call, I agree these sound good.

Think this is all resolved now, merged in set of changes to implement these standard interfaces. Thanks for the issue!