package main
import (
"fmt"
"unsafe"
)
type TMP struct {
a bool
b int32
c uint32
d []int
}
func main() {
tmp := TMP{a: false, b: 1, c: 2}
ptr := unsafe.Pointer(&tmp)
fmt.Println(&tmp.a)
fmt.Println(ptr)
*(*bool)(ptr) = true
fmt.Println(tmp)
*(*int32)(unsafe.Add(ptr, unsafe.Offsetof(tmp.b))) = 77777
fmt.Println(tmp)
*(*uint32)(unsafe.Add(ptr, unsafe.Offsetof(tmp.c))) = 88888
fmt.Println(tmp)
*(*[]int)(unsafe.Add(ptr, unsafe.Offsetof(tmp.d))) = []int{1, 2, 3}
fmt.Println(tmp)
}