Copy recursively copies all fields, map and slice elements from the value src to the pointer dst.
(dst, src interface{})
| 46 | // Copy recursively copies all fields, map and slice elements from the value |
| 47 | // src to the pointer dst. |
| 48 | func Copy(dst, src interface{}) error { |
| 49 | d, s := reflect.ValueOf(dst), reflect.ValueOf(src) |
| 50 | if d.Kind() != reflect.Ptr { |
| 51 | return fmt.Errorf("dst should be a pointer, got %T", dst) |
| 52 | } |
| 53 | return reflectCopy(d.Elem(), s, "val", seenMap{}) |
| 54 | } |
| 55 | |
| 56 | func reflectCopy(d, s reflect.Value, path string, seen seenMap) error { |
| 57 | // fmt.Printf("%v: d:%v (%v), s:%v (%v) %+v\n", path, d.Type(), d.Kind(), s.Type(), s.Kind(), s.Interface()) |
nothing calls this directly
no test coverage detected