This is explained here https://golang.org/doc/faq#nil_error
On Mon, 2017-08-21 at 09:41 -0700, ellief...@gmail.com wrote: > Hi, > > I just bumped heads with an odd behavior that I can't quite wrap my > head > around involving nil pointers to structs that encapsulate interfaces. > > The setup is a little convoluted, but I demonstrated it on the go > playground here: https://play.golang.org/p/2WKFjLOKzn > > Basically, if you encapsulate an interface in a struct, then call a > function who's signature states it will return a pointer to that > struct, nil > values returned from that function do not count as nil. > > It seems as if the nil is being coerced into the type of the pointer, > but > that doesn't make obvious sense in the context as the nil should, in > fact, > be nil. > > Any insights or explanations as to why this happens would be > appreciated. > > Thanks > -- 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. For more options, visit https://groups.google.com/d/optout.