Beego: 复制文档代码报错

Created on 28 Sep 2018  ·  1Comment  ·  Source: astaxie/beego

代码:
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")

Most helpful comment

@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
})

>All comments

@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
})
Was this page helpful?
0 / 5 - 0 ratings