I want to figure out, what happened underneath in golang, when converting a var to interface{}.
I recently is reading source of golang/src/reflect/type.go, and I couldnot understand the code in Line 1050, here is the code:
// Create a new ptrType starting with the description
// of an *unsafe.Pointer.
p = new(ptrType)
var iptr interface{} = (*unsafe.Pointer)(nil)
prototype := *(**ptrType)(unsafe.Pointer(&iptr))
*p = *prototype
I think the key is the behavior of assigning data to interface{}, can anyone help?