(controllerName string, moduleSource *Module)
| 431 | } |
| 432 | |
| 433 | func ControllerTypeByName(controllerName string, moduleSource *Module) (c *ControllerType) { |
| 434 | var found bool |
| 435 | if c, found = controllers[controllerName]; !found { |
| 436 | // Backup, passed in controllerName should be in lower case, but may not be |
| 437 | if c, found = controllers[strings.ToLower(controllerName)]; !found { |
| 438 | controllerLog.Debug("ControllerTypeByName: Cannot find controller in controllers map ", "controller", controllerName) |
| 439 | // Search for the controller by name |
| 440 | for _, cType := range controllers { |
| 441 | testControllerName := strings.ToLower(cType.Type.Name()) |
| 442 | if testControllerName == strings.ToLower(controllerName) && (cType.ModuleSource == moduleSource || moduleSource == anyModule) { |
| 443 | controllerLog.Warn("ControllerTypeByName: Matched empty namespace controller ", "controller", controllerName, "namespace", cType.ModuleSource.Name) |
| 444 | c = cType |
| 445 | break |
| 446 | } |
| 447 | } |
| 448 | } |
| 449 | } |
| 450 | return |
| 451 | } |
| 452 | |
| 453 | // Injects this instance (c) into the AppController instance. |
| 454 | func (c *Controller) setAppControllerFields() { |
no test coverage detected