MCPcopy Create free account
hub / github.com/google/gapid / Copy

Function Copy

core/data/deep/copy.go:48–54  ·  view source on GitHub ↗

Copy recursively copies all fields, map and slice elements from the value src to the pointer dst.

(dst, src interface{})

Source from the content-addressed store, hash-verified

46// Copy recursively copies all fields, map and slice elements from the value
47// src to the pointer dst.
48func 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
56func 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())

Callers

nothing calls this directly

Calls 2

reflectCopyFunction · 0.85
KindMethod · 0.65

Tested by

no test coverage detected