[英]AppEngine Standard Environment Pub/Sub Context in Go
Trying to get Pub/Sub working in AppEngine Standard Environment. 试图在AppEngine标准环境中使Pub / Sub工作。 Having problems getting the right context.
在获得正确的上下文时遇到问题。 The Pub/Sub client wants a
context.Context
but AppEngine only has appengine.Context
. Pub / Sub客户端需要一个
context.Context
但是AppEngine仅具有appengine.Context
。 Can't find any examples or anything related to this, except for flexible environment (using context.Background
) which I don't want to use. 除了我不想使用的灵活环境(使用
context.Background
)以外,找不到任何示例或与此相关的任何内容。 Am I the only person on the planet wanting to use Pub/Sub with AppEngine Standard Environment? 我是地球上唯一想要在AppEngine标准环境中使用Pub / Sub的人吗?
Ultimately I was using the wrong appengine
. 最终我使用了错误的
appengine
。 As of now, I have to import google.golang.org/appengine
like the examples for Go 1.9 . 截至目前,我必须像Go 1.9的示例一样导入
google.golang.org/appengine
。 This is because I was providing appengine.context
when I needed context.Context
. 这是因为我在需要
context.Context
时提供了appengine.context
。
context.Context
was introduced in Go 1.7 (2016) . context.Context
在Go 1.7(2016)中引入。 appengine.NewContext
was changed to return context.Context
in 2017 . appengine.NewContext
已更改为2017年返回context.Context
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.