go-lxc icon indicating copy to clipboard operation
go-lxc copied to clipboard

Consider using Functional Options

Open caglar10ur opened this issue 10 years ago • 4 comments

See http://dotgo.sourcegraph.com/post/99643162983/dave-cheney-functional-options and https://github.com/pkg/term/blob/master/term.go#L22

caglar10ur avatar Oct 11 '14 21:10 caglar10ur

I still a have strong urge to do this and break the API even after this many year :) Functional options are (eg; go-grpc style) is really my favorite way.

Maybe we can do that and bump the bindings to v3...

caglar10ur avatar Apr 27 '19 22:04 caglar10ur

I don't mind so Ack from me. @stgaber, @hallyn?

brauner avatar Apr 28 '19 12:04 brauner

@caglar10ur the link above is broken now, but I think you're referring to this article https://dave.cheney.net/2014/10/17/functional-options-for-friendly-apis

Sounds good :)

tomponline avatar Apr 28 '19 14:04 tomponline

@tomponline that is correct. go-grpc also uses that technique and the more I use it over the years the more I started to appreciate it. I don't know how would look like or fit into go-lxc but I'll give it a go in a branch and ping you to see what do you think about it before going ahead and changing everything.

caglar10ur avatar Apr 28 '19 20:04 caglar10ur