8 func CopyExact(dest interface{}, src interface{}) {
9 dV := reflect.ValueOf(dest)
10 sV := reflect.ValueOf(src)
11 if dV.Kind() == reflect.Ptr {
14 if dV.Kind() == reflect.Array && !dV.CanAddr() {
15 panic(fmt.Sprintf("dest not addressable: %T", dest))
17 if sV.Kind() == reflect.String {
18 sV = sV.Convert(dV.Type())
20 if dV.Len() != sV.Len() {
21 panic(fmt.Sprintf("dest len (%d) != src len (%d)", dV.Len(), sV.Len()))
23 if dV.Len() != reflect.Copy(dV, sV) {