Beego框架-API项目-我可以在控制器文件夹中使用文件夹结构吗

I want to group my controllers in some folder structure.

Application works if controllers are directly in 'controllers' folder.

Once I move controller to some controllers sub folder, router is not loading controller at all. (there's not compile errors)

Can anyone help me with that ?

I suspect you don't have the initialization code for your other controller packages.

For example, if you have a UserController in an admin package, like admin.UserController, you should also have one init() func in that admin package, that looks something like:

func init() {
    beego.Router("/admin/user", &admin.UserController{})
    // any other controllers register here ...
}

Also, make sure to import the controller package in your main package, probably as an underscore import if there is nothing directly using it:

import (
    _ "github.com/foo/bar/controllers/admin"
)