Panic when copying private properties.
When CopyProperties comes across private properties, it silently ignores them. This is error-prone and can result in a bug very hard to debug if the developer is unaware of the behavior. Change-Id: Id6a0752e384ec7fed35728c1e87dbfa95fea84f2
This commit is contained in:
parent
a9df651359
commit
7d699c37ec
1 changed files with 1 additions and 2 deletions
|
@ -35,8 +35,7 @@ func CopyProperties(dstValue, srcValue reflect.Value) {
|
|||
|
||||
for i, field := range typeFields(typ) {
|
||||
if field.PkgPath != "" {
|
||||
// The field is not exported so just skip it.
|
||||
continue
|
||||
panic(fmt.Errorf("can't copy a private field %q", field.Name))
|
||||
}
|
||||
|
||||
srcFieldValue := srcValue.Field(i)
|
||||
|
|
Loading…
Reference in a new issue