You can use builder to build options or the server. It is a much cleaner and self documenting method.
> On May 25, 2020, at 12:51 PM, sergey@netdata.cloud wrote: > > > Hello Amarjeet, > > You can actually don't check if len(options) is greater than one – if your > package provides only single implementation of Option, than there is no way > to pass something different than that backoffOption. But it also brings an > ability to extend your constructor later. There is a great article about > optional arguments: > https://sagikazarmark.hu/blog/functional-options-on-steroids/ > > I'd rather prefer optional arguments to builder. > > -- > Regards, > Sergey. > -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to golang-nuts+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/golang-nuts/1e07b530-7805-4221-a6a0-61de6ca219cb%40googlegroups.com. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/5DA103CD-C522-4883-A946-D0B32286A8AF%40ix.netcom.com.