Fix CopyProperties on interface to pointer to struct

CopyProperties expects to interfaces in a struct to be an
interface to a pointer to a struct, but expects to be called
on a struct.  When a struct contains an interface, dereference
it twice with Elem() before calling CopyProperties on it.

Change-Id: I0d10aff87729273a025ab6d86239fd60662a20c0
This commit is contained in:
Colin Cross 2014-12-18 13:05:14 -08:00
parent be1a9a10cd
commit f77510c1eb

View file

@ -79,7 +79,7 @@ func CopyProperties(dstValue, srcValue reflect.Value) {
dstFieldValue.Set(CloneProperties(elem))
} else {
// Re-use the existing allocation.
CopyProperties(dstFieldValue, srcFieldValue)
CopyProperties(dstFieldValue.Elem().Elem(), srcFieldValue.Elem().Elem())
}
} else {
dstFieldValue.Set(srcFieldValue)