我目前正在用Go编写一个应用程序,并试图部署多个服务。我正在运行以下命令:gcloud app deploy dispatch.yaml app/app.yaml mod1/mod1.yaml。
app.yaml文件对应于默认服务,并成功部署,但是服务mod1返回此错误:
ERROR: (gcloud.app.deploy) Error Response: [9] Deployment contains files that cannot be compiled: Compile failed: 2016/07/22 18:17:14 go-app-builder: build timing: 1×compile (53ms total), 0×link (0 total) 2016/07/22 18:17:14 go-app-builder: failed running compile: exit status 1
mod1.go:4: can't find import: "myapp/mod1/web_console"
My-Macbook: myapp$ gcloud app deploy dispatch.yaml app/app.yaml mod1/mod1.yaml我的文件结构如下:
- /mod1
- mod1.go
- mod1.yaml
- /web\_console
- web\_console.go
mod1.go :
package mod1
import (
"myapp/mod1/web_console"
)
func init() {
// Initializing Web Console establishes connection
// to the database and also creates routes
var wc *web_console.WebConsole
wc = web_console.NewWebConsole(true)
wc.Configure()
}mod1.yaml 1. :
module: mod1
runtime: go
api_version: go1
handlers:
- url: /.*
script: _go_appapp.yaml :
module: default
runtime: go
api_version: go1
handlers:
- url: /.*
script: _go_app谢谢你抽出时间来帮忙!
发布于 2016-07-23 02:24:08
每个GAE服务/模块都是独立的,不能访问以外的任何,服务/模块dir:
.yaml文件的目录。在您的特定情况下,您需要确保没有任何服务/模块引用父myapp dir (它只不过是应用程序的组织占位符,与您相关,但在GAE上没有实际存在)。我相信您的mod1.go导入应该如下所示:
package mod1
import (
"web_console"
)不过,吃点盐吧,我对围棋并不熟悉。
发布于 2016-07-23 04:12:18
似乎我使用了错误的工具来部署。我使用goapp deploy app/app.yaml mod1/mod1.yaml运行了这个命令,并且能够顺利地部署这些服务。
https://stackoverflow.com/questions/38537417
复制相似问题