From 28bb5c51bb79c0d679701cc86922296e525dfb4c Mon Sep 17 00:00:00 2001 From: rocinantex Date: Mon, 23 Mar 2020 16:22:34 +0800 Subject: [PATCH] fix bug: abount dependency injection Former-commit-id: 5538d9ba18a4fd70b90774ef6aaa684d81db4b09 --- hero/di/reflect.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/hero/di/reflect.go b/hero/di/reflect.go index 2e3bbd5f84..c1da311ae4 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, }