代码:
beego.Get("/", func(ctx *context.Context) {
})
报错:
cannot use func literal (type func(*"context".Context)) as type beego.FilterFunc in argument to beego.Get
import (context "context")
@lightbrotherV
the context package is "github.com/astaxie/beego/context" instead of go's "context".
import (
"github.com/astaxie/beego/context"
)
beego.Get("/", func(ctx *context.Context) {
... your code
})
Most helpful comment
@lightbrotherV
the context package is
"github.com/astaxie/beego/context"instead of go's"context".