From 7e0434889c6c2ceae04f6b543c1b0f07bf58de8a Mon Sep 17 00:00:00 2001 From: guoguangwu Date: Wed, 25 Oct 2023 12:18:46 +0800 Subject: [PATCH] chore: use strings.Contains instead --- module.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/module.go b/module.go index 8ed9d30b..7879a72a 100644 --- a/module.go +++ b/module.go @@ -66,7 +66,7 @@ func (m *Module) Namespace() (namespace string) { // Returns the named controller and action that is in this module. func (m *Module) ControllerByName(name, action string) (ctype *ControllerType) { comparison := name - if strings.Index(name, namespaceSeperator) < 0 { + if !strings.Contains(name, namespaceSeperator) { comparison = m.Namespace() + name } for _, c := range m.ControllerTypeList { @@ -129,9 +129,7 @@ func ModuleByName(name string) (*Module, bool) { // Loads the modules specified in the config. func loadModules() { keys := []string{} - for _, key := range Config.Options("module.") { - keys = append(keys, key) - } + keys = append(keys, Config.Options("module.")...) // Reorder module order by key name, a poor mans sort but at least it is consistent sort.Strings(keys)