unsafe Pointer
package main import ( "fmt" "unsafe" ) func main() { t := &T{"dd", 11} t1 := reflect.ValueOf(t) t2 := t1.Elem() t11 := reflect.TypeOf(t) t22 := t11.Elem().Field(1) fmt.Println(t22) t2.Field(0).SetString("22") t3 := t2.Field(1) fmt.Println(t3) fmt.Println(t1.Kind() == reflect.Ptr) fmt.Println(t2.NumField()) fmt.Println(t22.Tag.Get("json")) var g int = 12 g1 := (*uint)(unsafe.Pointer(&g)) *g1 = 110 fmt.Println(g) fmt.Printf("%T\n", g) }
知人难,相知相惜更难