diff --git a/hero/di/reflect.go b/hero/di/reflect.go index 2e3bbd5f8..c1da311ae 100644 --- a/hero/di/reflect.go +++ b/hero/di/reflect.go @@ -229,10 +229,13 @@ func lookupFields(elemTyp reflect.Type, skipUnexported bool, parentIndex []int) index = append(parentIndex, i) } + tmp := make([]int, len(index)) + copy(tmp, index) + field := field{ Type: f.Type, Name: f.Name, - Index: index, + Index: tmp, CanSet: isExported, }