github.com/hedzr/evendeep@v0.4.8/internal/cl/unexp_elder.go (about)

     1  //go:build !go1.18beta1
     2  // +build !go1.18beta1
     3  
     4  // for lower than 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  // }