Google app engine 为什么应用程序生成器找不到本地导入?
我目前正在用Go编写一个应用程序,并尝试部署多个服务。我正在运行以下命令:Google app engine 为什么应用程序生成器找不到本地导入?,google-app-engine,go,Google App Engine,Go,我目前正在用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: 2
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
我的文件结构如下:
- /我的计划
- /src
- /myapp
- /应用程序
- app.go
- app.yaml
- /mod1
- mod1.go
- mod1.yaml
- /网络控制台
- web_console.go
- /应用程序
- /myapp
- /src
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()
}
module: mod1
runtime: go
api_version: go1
handlers:
- url: /.*
script: _go_app
module: default
runtime: go
api_version: go1
handlers:
- url: /.*
script: _go_app
mod1.yaml:
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()
}
module: mod1
runtime: go
api_version: go1
handlers:
- url: /.*
script: _go_app
module: default
runtime: go
api_version: go1
handlers:
- url: /.*
script: _go_app
app.yaml:
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()
}
module: mod1
runtime: go
api_version: go1
handlers:
- url: /.*
script: _go_app
module: default
runtime: go
api_version: go1
handlers:
- url: /.*
script: _go_app
谢谢你花时间帮忙 每个GAE服务/模块都是独立的,无法访问服务/模块目录之外的任何内容,该目录:
- 是存在
文件的目录.yaml
- 是部署期间上载的内容
- 被视为该服务/模块的“根”目录,所有内容都与之相关
myapp
dir(它只是应用程序内容的组织占位符,与您相关,但在GAE上没有实际存在)。我相信您的mod1.go
导入应该如下所示:
package mod1
import (
"web_console"
)
但恕我直言,我对围棋并不熟悉。似乎我使用了错误的工具进行部署。我使用
goapp-deploy-app/app.yaml-mod1/mod1.yaml运行了该命令,并且能够成功地部署服务,没有问题。感谢您的回复!不幸的是,在更改导入语句后,我仍然得到错误:找不到导入:“web_控制台”。使用原始的导入语句?是的,没有更改任何内容。我不太确定到底发生了什么,所以我将更深入地研究文档。