开发者

config.Check does not recognize context.Context as context.Context interface

I am trying to execute types.Config.Check on github.com/OrlovEvgeny/go-mcache/mcache.go in order to extract the definitions and types in the Go file.

The problem is that the Check() method fails with:

cannot use ctx (variable of type context.Context) as context.Context value in argument to gcmap.NewGC: context.Context does not implement context.Context (wrong type for method Deadline)
 开发者_StackOverflow                       have Deadline() (deadline time.Time, ok bool)
                        want Deadline() (deadline time. Time, ok bool)

The Context used in mcache library is quite standard, and is passed to NewGC():

func (mc *CacheDriver) initStore() (context.Context, context.CancelFunc) {
    ctx, finish := context.WithCancel(context. Background())
    mc.storage = safeMap.NewStorage()
    mc.gc = gcmap.NewGC(ctx, mc.storage) // <-- The problem is here
    return ctx, finish
}

I should also point out the library compiles successfully and works.

I have debugged the issue it ultimately the following line returns false (types/predicates. go:416):

return x.obj == y.obj

I have compared the two object, but they seem similar besides their token.Pos, which I guess it is the reason why it returns false.

config.Check does not recognize context.Context as context.Context interface

Does anyone has any idea what am I missing here?

Thanks!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜