优化路由注册

This commit is contained in:
白茶清欢 2024-07-21 19:16:50 +08:00
parent f8f63691b7
commit deead87688

View File

@ -37,7 +37,7 @@ func init() {
// Author : go_developer@163.com<白茶清欢>
//
// Date : 21:40 2024/7/20
func Register(port int, controllerList ...any) {
func Register(port int, controllerList ...any) error {
for _, controller := range controllerList {
if nil == controller {
// 忽略空指针
@ -45,7 +45,7 @@ func Register(port int, controllerList ...any) {
}
parseController(controller)
}
ginRouter.Run(fmt.Sprintf(":%d", port))
return ginRouter.Run(fmt.Sprintf(":%d", port))
}
// parseController 解析controller