gpt4 book ai didi

google-app-engine - Go 中的 AppEngine 标准环境 Pub/Sub 上下文

转载 作者:数据小太阳 更新时间:2023-10-29 03:20:14 25 4
gpt4 key购买 nike

尝试让 Pub/Sub 在 AppEngine 标准环境中工作。在获取正确的上下文时遇到问题。 Pub/Sub 客户端需要一个 context.Context,但 AppEngine 只有 appengine.Context。找不到任何示例或与此相关的任何内容,除了我不想使用的灵活环境(使用 context.Background)。我是这个星球上唯一想在 AppEngine 标准环境中使用 Pub/Sub 的人吗?

最佳答案

最终我使用了错误的 appengine。截至目前,我必须像 examples for Go 1.9 一样导入 google.golang.org/appengine .这是因为我在需要 context.Context 时提供了 appengine.context

context.Context 是在 Go 1.7 (2016) 中引入的. appengine.NewContext 已更改为返回 context.Context in 2017 .

关于google-app-engine - Go 中的 AppEngine 标准环境 Pub/Sub 上下文,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55190601/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com