2016-08-09 10:26 GMT+02:00 Sam Salisbury <samsalisb...@gmail.com>:
> So, for purely academic reasons, what if I wanted to write a function to
> look inside an interface value to determine if its value pointer is nil?
>
> I tried this, following from your simplified example Steven....
> https://play.golang.org/p/oG2aQzlKfc
>
> var m map[string]interface{}
> var i interface{} = m                    // i is interface{}, right?
> id := reflect.ValueOf(i).InterfaceData() // nope, panics "call of
> reflect.Value.InterfaceData on map Value"

You can indirect via a pointer:

https://play.golang.org/p/NmnvqTdWHF

//jb

-- 
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.

Reply via email to