简体   繁体   English

我无法使用google.golang.org/appengine模块将Go模块部署到App Engine

[英]I can't deploy a Go module to App Engine using the google.golang.org/appengine modules

From the latest material I can read, and also based on documentation on certain APIs (for example, the Go Datastore API ), I'm supposed to use google.golang.org/appengine etc. instead of the old appengine/... paths. 从我可以阅读的最新资料,以及基于某些API的文档(例如, Go数据存储API ),我应该使用google.golang.org/appengine等而不是旧的appengine/...路径。 However, when I try to deploy using gcloud preview app deploy, I get the following error: 但是,当我尝试使用gcloud预览应用程序部署进行部署时,出现以下错误:

Deployment contains files that cannot be compiled: Compile failed: 部署包含无法编译的文件:编译失败:

 2016/01/14 14:32:43 go-app-builder: build timing: 2×6g (113ms total), 0×6l (0 total) 2016/01/14 14:32:43 go-app-builder: failed running 6g: exit status 1 server/alexa.go:10: can't find import: "golang.org/x/net/context" 

The golang.org/x/net/context package supposedly replaces the old appengine/context one, but it doesn't appear to be available in the deployment server's GOROOT . golang.org/x/net/context包应该替换旧的appengine/context 1,但它似乎在部署服务器的GOROOT

I tried including all the dependencies and their dependencies in my package repo but that only lead me to this obscure error (the directory it's complaining about actually exists): 我尝试在我的包repo中包含所有依赖项及其依赖项,但这只会导致我这个模糊的错误(它抱怨的目录实际存在):

Deployment contains files that cannot be compiled: Compile failed: 部署包含无法编译的文件:编译失败:

 2016/01/14 14:27:04 go-app-builder: build timing: 18×6g (1.819s total), 0×6l (0 total) 2016/01/14 14:27:04 go-app-builder: failed running 6g: exit status 1 github.com/golang/protobuf/protoc-gen-go/testdata/my_test/test.pb.go:27: can't find import: "github.com/golang/protobuf/protoc-gen-go/testdata/multi" 

Have I misunderstood the documentation and am only supposed to use the old packages? 我误解了文档并且只应该使用旧包吗?

You need to do a go get golang.org/x/net/context to save that package in your go src directory. 你需要go get golang.org/x/net/context将该软件包保存在go src目录中。 Though, when working with App Engine it is not necessary. 但是,在使用App Engine时,没有必要。 Those libraries can be imported and used, but they mostly focused on applications run outside of App Engine, ie Container Engine or Compute Engine. 这些库可以导入和使用,但它们主要集中在App Engine外部运行的应用程序,即Container Engine或Compute Engine。 They essentially hook into the RESTful APIs Google cooked up for those services. 它们基本上是为谷歌为这些服务编写的RESTful API。 If you decide to work directly with Google Cloud Storage you would need those libraries since App Engine expects you to use Blobstore instead. 如果您决定直接使用Google云端存储,那么您需要这些库,因为App Engine希望您使用Blobstore。 Hope this helps. 希望这可以帮助。

If you are using gosdk, just run goapp get in the same directory as your .go file and it will download and install the dependencies to your gosdk installation. 如果您正在使用gosdk,只需将goapp getgoapp get文件放在同一目录中,它就会下载并安装依赖项到您的gosdk安装。 You then deploy the app again and it should compile without problem. 然后再次部署应用程序,它应该编译没有问题。

When it's working there's no prompt and files will be downloaded to gosdk\\gopath\\src 当它工作时没有提示,文件将被下载到gosdk \\ gopath \\ src

After fininshing there will be a warning message which can be ignored: fininshing后会有一条警告信息可以忽略:

go install: no install location for directory C:\\your_current_directory outside GOPATH For more details see: go help gopath go install:目录C:\\ your_current_directory在GOPATH之外没有安装位置有关详细信息,请参阅:go help gopath

For the record, this issue is now fixed with gcloud version 142 . 为了记录,此问题现已通过gcloud版本142修复。 One should now be able to deploy using gcloud beta app deploy --project <project> app.yaml . 现在应该可以使用gcloud beta app deploy --project <project> app.yaml Use gcloud components update to upgrade the command line. 使用gcloud components update来升级命令行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 用日志级别替换 Go App Engine "google.golang.org/appengine/log" package? - Replacement for Go App Engine "google.golang.org/appengine/log" package, with log levels? AppEngine:找不到导入“google.golang.org/appengine” - AppEngine: can't find import “google.golang.org/appengine” 如何使用这些包“ google.golang.org/appengine/mail”在Go中上传附件 - How to upload an attachments in Go using these package “google.golang.org/appengine/mail” google.golang.org/appengine/datastore与cloud.google.com/go/datastore - google.golang.org/appengine/datastore vs cloud.google.com/go/datastore 当我从 google.golang.org/appengine/log 调用 log.Infof() 时,记录 output“/logservice.Flush 未注册” - When I called log.Infof() from google.golang.org/appengine/log, Logging output "/logservice.Flush is not registered" c.Infof undefined(类型context.Context没有字段或方法Infof)google.golang.org/appengine/log错误 - c.Infof undefined (type context.Context has no field or method Infof) google.golang.org/appengine/log error Google AppEngine-自动部署到App引擎失败 - Google AppEngine - Auto deploy to App engine failing 无法将 Go 应用程序错误 422 部署到 AppEngine - Can't Deploy Go app Error 422 to AppEngine 无法将 Tesseract 部署到 Google App Engine - Can't deploy Tesseract to Google App Engine Google App Engine - 不会部署一个模块 - Google App Engine - One module doesn't deploy
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM