Hi, thank you for everyone! The main point here is: "generally isn't needed", but sometimes structure does not come described properly in some kind of string representation. :-) the pair Func / funchandler - just excellent ! But what about other GO-4 patterns, I mean "isn't needed in go" ? Where take a look at ?
Thank you. On Thursday, April 1, 2021 at 4:29:14 PM UTC+3 ren...@ix.netcom.com wrote: > The Go protobufs impl uses the builder pattern. > > On Apr 1, 2021, at 2:21 AM, Brian Candler <b.ca...@pobox.com> wrote: > > The builder pattern generally isn't needed in go, because go has flexible > struct literals where you can omit any members you don't want. > > > You can implement it if you like, but it just adds a layer of boilerplate: > https://gist.github.com/vaskoz/10073335 > > Some people are drawn to functional options instead: > https://dave.cheney.net/2014/10/17/functional-options-for-friendly-apis > > https://www.calhoun.io/using-functional-options-instead-of-method-chaining-in-go/ > > But if you look at the standard library as a source of inspiration and > good practice, complex configuration is typically done via structs. See > for example http.Server <https://golang.org/pkg/net/http/#Server> > > -- > 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...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/golang-nuts/39e38cd7-93ee-4084-89e4-a22bcd1baaa6n%40googlegroups.com > > <https://groups.google.com/d/msgid/golang-nuts/39e38cd7-93ee-4084-89e4-a22bcd1baaa6n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > > -- 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/cd0d77b4-f86e-4244-8e60-70ee07b96ad4n%40googlegroups.com.