github.com/hedzr/evendeep@v0.4.8/internal/cl/unexp118.go (about) 1 //go:build go1.18beta1 2 // +build go1.18beta1 3 4 // for go1.18+ 5 6 package cl 7 8 // // setUnexportedField puts a new value into the unexported field 9 // func setUnexportedField(field, value reflect.Value) { 10 // ptr := reflect.NewAt(field.Type(), unsafe.Pointer(field.UnsafeAddr())) 11 // dat := ptr.Elem() 12 // dat.Set(value) 13 // }