Skip to content

Commit ef43ece

Browse files
committed
fix: barry quick fix, 2025-06-09 13:33:03
1 parent 177ce65 commit ef43ece

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

dixinternal/dix.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ func (x *Dix) injectFunc(vp reflect.Value, opt Options) {
210210
for i := 0; i < vp.Type().NumIn(); i++ {
211211
switch inTyp := vp.Type().In(i); inTyp.Kind() {
212212
case reflect.Interface, reflect.Ptr, reflect.Func, reflect.Struct:
213-
inTypes = append(inTypes, &providerInputType{typ: inTyp})
213+
inTypes = append(inTypes, &providerInputType{typ: inTyp, isStruct: inTyp.Kind() == reflect.Struct})
214214
case reflect.Map:
215215
isList := inTyp.Elem().Kind() == reflect.Slice
216216
typ := inTyp.Elem()
@@ -371,6 +371,7 @@ func (x *Dix) handleProvide(fnVal reflect.Value, out reflect.Type, in []*provide
371371
n.output = &providerOutputType{typ: outTyp}
372372
x.providers[n.output.typ] = append(x.providers[n.output.typ], n)
373373
case reflect.Struct:
374+
n.output.isStruct = true
374375
for i := 0; i < outTyp.NumField(); i++ {
375376
x.handleProvide(fnVal, outTyp.Field(i).Type, in)
376377
}

dixinternal/provider.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@ import (
1111
)
1212

1313
type providerInputType struct {
14-
typ reflect.Type
15-
isMap bool
16-
isList bool
14+
typ reflect.Type
15+
isMap bool
16+
isList bool
17+
isStruct bool
1718
}
1819

1920
func (v providerInputType) Validate() error {
@@ -33,9 +34,10 @@ func (v providerInputType) Validate() error {
3334
}
3435

3536
type providerOutputType struct {
36-
typ reflect.Type
37-
isMap bool
38-
isList bool
37+
typ reflect.Type
38+
isMap bool
39+
isList bool
40+
isStruct bool
3941
}
4042

4143
type providerFn struct {

0 commit comments

Comments
 (0)