Invoke runs the given function after instantiating its dependencies. Any arguments that the function has are treated as its dependencies. The dependencies are instantiated in an unspecified order along with any dependencies that they might have. The function may return an error to indicate failure.
(function interface{})
| 440 | // It internally calls uber's dig library. Consult dig's documentation for |
| 441 | // details. (https://pkg.go.dev/go.uber.org/dig) |
| 442 | func (c *C) Invoke(function interface{}) { |
| 443 | err := c.di.Invoke(function) |
| 444 | if err != nil { |
| 445 | panic(err) |
| 446 | } |
| 447 | } |
| 448 | |
| 449 | func isCleanup(v reflect.Type) bool { |
| 450 | if v.Kind() == reflect.Func && v.NumIn() == 0 && v.NumOut() == 0 { |
no outgoing calls