github.com/fengyoulin/inspect@v0.2.1/eface.go (about) 1 package inspect 2 3 import ( 4 "reflect" 5 "unsafe" 6 ) 7 8 type eFace struct { 9 typ, data unsafe.Pointer 10 } 11 12 // PackEFace from type and data 13 func PackEFace(typ reflect.Type, data unsafe.Pointer) (i interface{}) { 14 e := (*eFace)(unsafe.Pointer(&i)) 15 t := (*eFace)(unsafe.Pointer(&typ)) 16 e.typ = t.data 17 e.data = data 18 return 19 }