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.

Reply via email to