dongshi2588 2016-07-23 01:55
浏览 35

为什么Go-App-Builder无法找到本地进口商品?

I am currently writing an application in Go and trying to deploy multiple services. I am running the following command : gcloud app deploy dispatch.yaml app/app.yaml mod1/mod1.yaml.

The app.yaml file corresponds to the default service and is successfully deployed however the service mod1 returns this error:

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

My file structure is as follows:

  • /My_Project
    • /src
      • /myapp
        • /app
          • app.go
          • app.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 :

module: mod1
runtime: go
api_version: go1

handlers:
- url: /.*
  script: _go_app

app.yaml :

module: default
runtime: go
api_version: go1

handlers:
- url: /.*
 script: _go_app

Thanks for taking the time to help!

  • 写回答

2条回答 默认 最新

  • doupu3635 2016-07-23 02:24
    关注

    Each GAE service/module is standalone and can not access anything outside the service/module dir which:

    • is the directory where the .yaml file exists
    • is what's uploaded during deployment
    • is considered the "root" directory for that service/module, everything is relative to it

    In your particular case you need to make sure no service/module makes references to the parent myapp dir (which is nothing but an organisational placeholder for the app stuff, relevant on your side but with no actual presence on GAE). I believe your mod1.go import should looks like this:

    package mod1
    
    import (
        "web_console"
    )
    

    But take it with a grain of salt, I'm not actually familiar with go.

    评论

报告相同问题?

悬赏问题

  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂
  • ¥15 wordpress 产品图片 GIF 没法显示
  • ¥15 求三国群英传pl国战时间的修改方法
  • ¥15 matlab代码代写,需写出详细代码,代价私
  • ¥15 ROS系统搭建请教(跨境电商用途)
  • ¥15 AIC3204的示例代码有吗,想用AIC3204测量血氧,找不到相关的代码。