and I change one line code, than program does not panic.
func TestPoint(t *testing.T) {
type A struct {
X int
Y string
}
type B struct {
X int
Y string
Z string
}
a := A{X: 2, Y: "yy"}
b := (*B)(unsafe.Pointer(&a))
b.Z = "zz"
// fmt.Printf(" z: %v\n", b.Z)
fmt.Printf(" z: %v\n", &b.Z) // a move to heap
return
}
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.