I struggled to understand this for a white and just after posting I embarrassingly notice that it's just a form of chaining and handler is passed on. Sorry for the noise
On Tuesday, March 24, 2020 at 9:44:31 PM UTC+2, Karolis Tamutis wrote: > > Hi, > > I'm struggling to understand what's the point of doing the below > > ... > handler = &logHandler{log: log, next: handler} // add logging > handler = ensureSessionID(handler) // add session ID > handler = &ochttp.Handler{ // add opencensus > instrumentation > ... > > Isn't the logHandler struct pointer just thrown away in the next line and > so on? If the expressions are evaluated just for their effects and value is > to be discarded why just not assign it in the first place? > > > https://github.com/GoogleCloudPlatform/microservices-demo/blob/ccff406cdcd3e043b432fe99b4038d1b4699c702/src/frontend/main.go#L147 > -- 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/b32ba0a2-92c8-45ae-800d-2db25868e9aa%40googlegroups.com.