按照beego官方文档 [注解路由](https://beego.me/docs/mvc/controller/router.md#%E6%B3%A8%E8%A7%A3%E8%B7%AF%E7%94%B1) 尝试写的路由,但是确实报错的:goland提示:unresolved type CMSController
cms.go中的代码
```
package controllers
import (
"github.com/astaxie/beego"
)
// CMSController operations for CMS
type CMSController struct {
beego.Controller
}
// URLMapping ...
func (c *CMSController) URLMapping() {
c.Mapping("StaticBlock", c.StaticBlock)
c.Mapping("AllBlock", c.AllBlock)
}
// @router /staticblock/:key [get]
func (this *CMSController) StaticBlock() {
}
// @router /all/:key [get]
func (this *CMSController) AllBlock() {
}
```
router.go中的代码:
```
package routers
import (
"quickstart/controllers"
"github.com/astaxie/beego"
"github.com/astaxie/beego/context"
)
func init() {
beego.Router("/", &controllers.MainController{})
beego.Get("/base", func(ctx *context.Context) {
ctx.Output.Body([]byte("hello world"))
})
beego.Post("/alice", func(ctx *context.Context) {
ctx.Output.Body([]byte("bob"))
})
beego.Any("/foo", func(ctx *context.Context) {
ctx.Output.Body([]byte("bar"))
})
beego.Include(&CMSController{})
}
```
完全照抄beego这节内容的代码,但是还是报这个错误
bee run 的时候,也报错:
```
routers/router.go:23:17: undefined: CMSController
2018/04/08 23:12:08 ERROR ▶ 0003 Failed to build the application: # quickstart/routers
routers/router.go:23:17: undefined: CMSController
```
请问这个错误,应该怎么解决?
还是说,注解路由只支持API类的项目?
更多评论
```go
beego.Include(&CMSController{})
//改成
beego.Include(&controllers.CMSController{})
```
#2