The question is: Why would you want to know? nil-pointers are perfectly fine implementations of an interface. By caring whether the value implementing your interface is a nil-pointer, you are breaking the abstraction of your interface.
On Thu, Feb 16, 2017 at 8:37 PM, Dragos Harabor <dh...@harabor.com> wrote: > Actually it doesn't do what I asked, sorry if I was not clear, I was > expecting your example to print "true true", got excited too quickly. > > https://play.golang.org/p/WnDyT9OOpr > > > On Thursday, February 16, 2017 at 11:32:59 AM UTC-8, Dragos Harabor wrote: >> >> Nice, thank you! >> >> On Thursday, February 16, 2017 at 11:25:31 AM UTC-8, Jan Mercl wrote: >>> >>> On Thu, Feb 16, 2017 at 8:20 PM Dragos Harabor <dh...@harabor.com> >>> wrote: >>> >>> > Is there any way to check whether the value stored in a non-nil >>> interface is nil when you don't know the type, short of using >>> reflect.Value.IsNil()? >>> >>> For example: https://play.golang.org/p/Sdqx7Frjxj >>> >>> -- >>> >>> -j >>> >> -- > 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. > -- 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.