我可以直接在没有beego中的路由器的情况下直接从主站调用控制器吗

I have a controller say XXController from package xx. Now i want this controller to be called as an function like xx.XXController{}. And the login inside controller should get executed.

This is an example I found using Beego Framework. Hope this helps.

Link to example Code

package routers

import (
    "github.com/astaxie/beego"
    ctl "github.com/ikeikeikeike/beego-samples/auth/controllers"
)

func init() {
    beego.Router("/", &ctl.UsersController{}, "get:Index")
    beego.Router("/login", &ctl.LoginController{}, "get,post:Login")
    beego.Router("/logout", &ctl.LoginController{}, "get:Logout")
    beego.Router("/signup", &ctl.LoginController{}, "get,post:Signup")
}