Use functional options
adammck opened this issue · 3 comments
adammck commented
Dear Lazyweb: It would be nice if our API looked less like
gz.NewGzipLevelAndMinSize(1, 1024)(myHandler)
and more like
gz.New(myHandler, gz.CompressionLevel(1), gz.MinSize(1024))
See Functional options for friendly APIs. I'm open to other solutions, too.
jprobinson commented
After playing around with more and more go-kit, I've been leaning towards the latter lately.
tmthrgd commented
This was fixed with the merging of #51.
The main difference was that the options take the form:
wrap, _ := gz.GzipHandlerWithOpts(gz.CompressionLevel(1), gz.MinSize(1024))
wrap(myHandler)
instead of:
gz.New(myHandler, gz.CompressionLevel(1), gz.MinSize(1024))
Either this should be closed or considered a request to add the New
function described above.
dolmen commented
If this is fixed, it might be time for close of this issue, isn't it?
I'm discovering this project and most open issues seem to be in fact done. Discovering that after the read of a long discussion is unexpected.