Writer? Encoder? Putter?
I am creating a library for writing certain data objects (hence MyStruct) to an io.Writer. I was trying to find how Go's standard library typically names interfaces like that so that I could stick to the conventional naming.
Seems that the
JSON package uses Encoder and Encode. The
CSV package uses Writer and Write. I see that the Encode naming is more common in the encoding/... packages, but these usually encode general values (interface{}) and not specific types (like MyStruct).
What would be an idiomatic naming/API design for a case like this?
What makes CSV a writer and JSON an encoder?