File tree Expand file tree Collapse file tree 2 files changed +4
-6
lines changed Expand file tree Collapse file tree 2 files changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import (
10
10
)
11
11
12
12
type a struct {
13
+ b
13
14
B b
14
15
}
15
16
@@ -29,7 +30,8 @@ func main() {
29
30
})
30
31
31
32
arg := di .Inject (new (a ))
32
- assert .If (arg .B .C .C != "hello" , "not match" )
33
+ assert .If (arg .C .C != "hello" , "not match" )
34
+ fmt .Println (arg .C .C )
33
35
fmt .Println (arg .B .C .C )
34
36
fmt .Println (di .Graph ())
35
37
Original file line number Diff line number Diff line change @@ -296,12 +296,8 @@ func (x *Dix) injectFunc(vp reflect.Value, opt Options) {
296
296
func (x * Dix ) injectStruct (vp reflect.Value , opt Options ) {
297
297
tp := vp .Type ()
298
298
for i := 0 ; i < tp .NumField (); i ++ {
299
- if ! vp .Field (i ).CanSet () {
300
- continue
301
- }
302
-
303
299
field := tp .Field (i )
304
- if field .Anonymous {
300
+ if ! vp . Field ( i ). CanSet () && field .Type . Kind () != reflect . Struct {
305
301
continue
306
302
}
307
303
You can’t perform that action at this time.
0 commit comments