【发布时间】:2016-10-05 12:39:36
【问题描述】:
我正在“App Engine 柔性环境”(以前称为“托管虚拟机”)上直接使用 golang 开发 API。
到目前为止,我一直在我的 .go 文件中使用这种导入:
import (
"appengine"
"appengine/datastore"
...)
最近我决定使用 Google Cloud Storage 来存储图像。它需要导入“cloud.google.com/go/storage”。我的问题是我无法使用此导入(未找到)或我用于 appengine 导入的任何其他短版本(“go/storage”)部署应用程序。
经过大量研究,我发现了这个:https://github.com/golang/appengine#user-content-3-update-code-using-deprecated-removed-or-modified-apis
它指定如何将使用短导入(已弃用,如我的)的应用程序迁移到完整导入(使用明确的存储库,如“google.golang.org/appengine”)
我按照程序并使用他们提供的脚本来更新我的代码 (aefix)。他们还说要将此行添加到我的 app.yaml 文件中:
vm : true
如果我这样做了,我会在运行“gcloud app deploy”时收到此错误消息:
ERROR: (gcloud.app.deploy) Your application does not satisfy all of the requirements for a runtime of type [go]. Please correct the errors and try again.
如果我不这样做,我的导入都不起作用,我收到以下错误:
can't find import: "google.golang.org/appengine/datastore"
这是我的 app.yaml 文件:
runtime: go
api_version: go2
#vm : true
handlers:
- url: /.*
script: _go_app
当然,所有的导入都在 $GOPATH/src/ 下的服务器上,所以它们并没有真正丢失,我猜是更糟糕的引用。
我被这个问题困扰了好几天了,任何形式的帮助都将不胜感激!
谢谢
【问题讨论】:
标签: google-app-engine go google-cloud-storage