MCPcopy Create free account
hub / github.com/golobby/container / validateResolverFunction

Method validateResolverFunction

container.go:78–93  ·  view source on GitHub ↗
(funcType reflect.Type)

Source from the content-addressed store, hash-verified

76}
77
78func (c Container) validateResolverFunction(funcType reflect.Type) error {
79 retCount := funcType.NumOut()
80
81 if retCount == 0 || retCount > 2 {
82 return errors.New("container: resolver function signature is invalid - it must return abstract, or abstract and error")
83 }
84
85 resolveType := funcType.Out(0)
86 for i := 0; i < funcType.NumIn(); i++ {
87 if funcType.In(i) == resolveType {
88 return fmt.Errorf("container: resolver function signature is invalid - depends on abstract it returns")
89 }
90 }
91
92 return nil
93}
94
95// invoke calls a function and its returned values.
96// It only accepts one value and an optional error.

Callers 1

bindMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected