英文:
Go Appengine Managed VM issue: unknown flag -trimpath
问题
我正在尝试使用托管的虚拟机在App Engine上部署一个Go应用程序。据我所知,我在本地成功运行了Docker,并满足了所有的依赖关系,但是当我尝试在本地提供服务时,遇到了以下错误:
INFO 2015-03-05 22:21:14,917 containers.py:280] /goroot/pkg/tool/linux_amd64/6g: unknown flag -trimpath
INFO 2015-03-05 22:21:14,922 containers.py:280] 2015/03/05 22:21:14 go-app-builder: build timing: 1×6g (5ms total), 0×gopack (0 total), 0×6l (0 total)
INFO 2015-03-05 22:21:14,923 containers.py:280] 2015/03/05 22:21:14 go-app-builder: failed running 6g: exit status 1
我使用的是MacOS和boot2docker。我一直能够在本地无问题地运行appengine,所以我认为这可能与Docker或其中的Go版本有关,或者与其他一些问题有关。非常感谢任何能够指导我正确方向的人。在这个问题上似乎没有太多相关信息。
完整的跟踪信息如下:
➜ appengine-try-go gcloud preview app run ./app.yaml
Module [default] found in file [/Users/markhayden/google-cloud-sdk/platform/google_appengine/goroot/src/appengine-try-go/app.yaml]
INFO: Looking for the Dockerfile in /Users/markhayden/google-cloud-sdk/platform/google_appengine/goroot/src/appengine-try-go
INFO: Using Dockerfile found in /Users/markhayden/google-cloud-sdk/platform/google_appengine/goroot/src/appengine-try-go
INFO 2015-03-05 22:21:13,424 devappserver2.py:726] Skipping SDK update check.
INFO 2015-03-05 22:21:13,485 api_server.py:172] Starting API server at: http://localhost:63533
INFO 2015-03-05 22:21:13,521 vm_runtime_proxy_go.py:107] Starting Go VM Deployment process
INFO 2015-03-05 22:21:13,521 dispatcher.py:186] Starting module "default" running at: http://localhost:8080
INFO 2015-03-05 22:21:13,524 admin_server.py:118] Starting admin server at: http://localhost:8000
INFO 2015-03-05 22:21:13,545 containers.py:259] Building docker image whiskey-tango-foxtrot.default.1 from /var/folders/lv/9hzw2s5d25v17j4wph5pl46c0000gn/T/tmpFreenWgo_deployment_dir/Dockerfile:
INFO 2015-03-05 22:21:13,545 containers.py:261] -------------------- DOCKER BUILD --------------------
INFO 2015-03-05 22:21:14,312 containers.py:280] ---> 3b6b889b2273
INFO 2015-03-05 22:21:14,312 containers.py:280] Step 1 : ADD . /app
INFO 2015-03-05 22:21:14,561 containers.py:280] ---> b994e021ab2e
INFO 2015-03-05 22:21:14,570 containers.py:280] Removing intermediate container 332c78e9be28
INFO 2015-03-05 22:21:14,571 containers.py:280] Step 2 : RUN /bin/bash /app/_ah/build.sh
INFO 2015-03-05 22:21:14,676 containers.py:280] ---> Running in 7e4157c8b5b2
INFO 2015-03-05 22:21:14,905 containers.py:280] b02fde1ce30965d84e52f461de37655580e16956 /app/_ah/gab
INFO 2015-03-05 22:21:14,917 containers.py:280] /goroot/pkg/tool/linux_amd64/6g: unknown flag -trimpath
INFO 2015-03-05 22:21:14,922 containers.py:280] 2015/03/05 22:21:14 go-app-builder: build timing: 1×6g (5ms total), 0×gopack (0 total), 0×6l (0 total)
INFO 2015-03-05 22:21:14,923 containers.py:280] 2015/03/05 22:21:14 go-app-builder: failed running 6g: exit status 1
ERROR 2015-03-05 22:21:15,097 containers.py:283] The command [/bin/sh -c /bin/bash /app/_ah/build.sh] returned a non-zero code: 1
INFO 2015-03-05 22:21:15,097 containers.py:292] --------------------------------------------------------
INFO 2015-03-05 22:21:15,098 vm_runtime_proxy_go.py:133] Go VM Deployment process failed: Docker build aborted: The command [/bin/sh -c /bin/bash /app/_ah/build.sh] returned a non-zero code: 1
ERROR 2015-03-05 22:21:15,098 instance.py:280] Docker build aborted: The command [/bin/sh -c /bin/bash /app/_ah/build.sh] returned a non-zero code: 1
INFO 2015-03-05 22:21:15,098 health_check_service.py:101] Health checks starting for instance 0.
如果有人需要更详细的输出,请在此处查看:https://gist.github.com/markhayden/1090aa3c232f56788a1f
更新
现在还遇到了2015/03/12 07:34:09 Can't find package "appengine" in $GOPATH: cannot find package "appengine" in any of:
的问题。看起来下面的评论可能已经解决了trimpath的问题,但现在这个问题阻止我确认。有人能帮助我确认如何设置我的gopath / goroot以解决这个问题吗?而且,不清楚它是在docker容器中还是在我的本地机器上查找缺失的包?
英文:
I am attempting to get a go app up on appengine using managed vms. As far as I can tell I have docker running locally fine and all the dependencies fulfilled but when I try and serve it locally I run into the following error:
INFO 2015-03-05 22:21:14,917 containers.py:280] /goroot/pkg/tool/linux_amd64/6g: unknown flag -trimpath
INFO 2015-03-05 22:21:14,922 containers.py:280] 2015/03/05 22:21:14 go-app-builder: build timing: 1×6g (5ms total), 0×gopack (0 total), 0×6l (0 total)
INFO 2015-03-05 22:21:14,923 containers.py:280] 2015/03/05 22:21:14 go-app-builder: failed running 6g: exit status 1
Running MacOs & boot2docker. Have always been able to run appengine locally without issue so I assume this has something to do with docker / the go version there or something else goofy. Would be super grateful to anyone that can point me in the right direction. Doesn't seem to be much out there on this one.
Full trace is below:
➜ appengine-try-go gcloud preview app run ./app.yaml
Module [default] found in file [/Users/markhayden/google-cloud-sdk/platform/google_appengine/goroot/src/appengine-try-go/app.yaml]
INFO: Looking for the Dockerfile in /Users/markhayden/google-cloud-sdk/platform/google_appengine/goroot/src/appengine-try-go
INFO: Using Dockerfile found in /Users/markhayden/google-cloud-sdk/platform/google_appengine/goroot/src/appengine-try-go
INFO 2015-03-05 22:21:13,424 devappserver2.py:726] Skipping SDK update check.
INFO 2015-03-05 22:21:13,485 api_server.py:172] Starting API server at: http://localhost:63533
INFO 2015-03-05 22:21:13,521 vm_runtime_proxy_go.py:107] Starting Go VM Deployment process
INFO 2015-03-05 22:21:13,521 dispatcher.py:186] Starting module "default" running at: http://localhost:8080
INFO 2015-03-05 22:21:13,524 admin_server.py:118] Starting admin server at: http://localhost:8000
INFO 2015-03-05 22:21:13,545 containers.py:259] Building docker image whiskey-tango-foxtrot.default.1 from /var/folders/lv/9hzw2s5d25v17j4wph5pl46c0000gn/T/tmpFreenWgo_deployment_dir/Dockerfile:
INFO 2015-03-05 22:21:13,545 containers.py:261] -------------------- DOCKER BUILD --------------------
INFO 2015-03-05 22:21:14,312 containers.py:280] ---> 3b6b889b2273
INFO 2015-03-05 22:21:14,312 containers.py:280] Step 1 : ADD . /app
INFO 2015-03-05 22:21:14,561 containers.py:280] ---> b994e021ab2e
INFO 2015-03-05 22:21:14,570 containers.py:280] Removing intermediate container 332c78e9be28
INFO 2015-03-05 22:21:14,571 containers.py:280] Step 2 : RUN /bin/bash /app/_ah/build.sh
INFO 2015-03-05 22:21:14,676 containers.py:280] ---> Running in 7e4157c8b5b2
INFO 2015-03-05 22:21:14,905 containers.py:280] b02fde1ce30965d84e52f461de37655580e16956 /app/_ah/gab
INFO 2015-03-05 22:21:14,917 containers.py:280] /goroot/pkg/tool/linux_amd64/6g: unknown flag -trimpath
INFO 2015-03-05 22:21:14,922 containers.py:280] 2015/03/05 22:21:14 go-app-builder: build timing: 1×6g (5ms total), 0×gopack (0 total), 0×6l (0 total)
INFO 2015-03-05 22:21:14,923 containers.py:280] 2015/03/05 22:21:14 go-app-builder: failed running 6g: exit status 1
ERROR 2015-03-05 22:21:15,097 containers.py:283] The command [/bin/sh -c /bin/bash /app/_ah/build.sh] returned a non-zero code: 1
INFO 2015-03-05 22:21:15,097 containers.py:292] --------------------------------------------------------
INFO 2015-03-05 22:21:15,098 vm_runtime_proxy_go.py:133] Go VM Deployment process failed: Docker build aborted: The command [/bin/sh -c /bin/bash /app/_ah/build.sh] returned a non-zero code: 1
ERROR 2015-03-05 22:21:15,098 instance.py:280] Docker build aborted: The command [/bin/sh -c /bin/bash /app/_ah/build.sh] returned a non-zero code: 1
INFO 2015-03-05 22:21:15,098 health_check_service.py:101] Health checks starting for instance 0.
For anyone looking, more verbose output can be found here: https://gist.github.com/markhayden/1090aa3c232f56788a1f
Update
Now also getting 2015/03/12 07:34:09 Can't find package "appengine" in $GOPATH: cannot find package "appengine" in any of:
when trying to fire things up. Looks like the comment below might have solved the trimpath issue but now this one is stopping me from confirming. Anyone able to help me confirm how I should be setting my gopath / goroot to get this one resolved? Also, its unclear if its trying to locate the missing packages in the docker container or locally on my machine?
INFO 2015-03-12 07:34:11,311 containers.py:280] b02fde1ce30965d84e52f461de37655580e16956 /app/_ah/gab
INFO 2015-03-12 07:34:11,359 containers.py:280] 2015/03/12 07:34:09 Can't find package "appengine" in $GOPATH: cannot find package "appengine" in any of:
INFO 2015-03-12 07:34:11,360 containers.py:280] /goroot/src/appengine (from $GOROOT)
INFO 2015-03-12 07:34:11,364 containers.py:280] /gopath/src/appengine (from $GOPATH)
INFO 2015-03-12 07:34:11,720 containers.py:280] /tmp/work/main.go:4: can't find import: "appengine"
INFO 2015-03-12 07:34:11,721 containers.py:280] 2015/03/12 07:34:09 go-app-builder: build timing: 3×6g (355ms total), 0×gopack (0 total), 0×6l (0 total)
INFO 2015-03-12 07:34:11,722 containers.py:280] 2015/03/12 07:34:09 go-app-builder: failed running 6g: exit status 1
ERROR 2015-03-12 07:34:11,937 containers.py:283] The command [/bin/sh -c /bin/bash /app/_ah/build.sh] returned a non-zero code: 1
答案1
得分: 2
我在google-appengine-go列表上发布了关于这个问题的帖子,解决方法是在你的Dockerfile中添加以下行,至少在基础镜像更新之前。
RUN rm -rf /goroot && mkdir /goroot && curl https://storage.googleapis.com/golang/go1.4.2.linux-amd64.tar.gz | tar xvzf - -C /goroot --strip-components=1
英文:
I posted about this on the google-appengine-go list, the solution is to add the following line to your Dockerfile, at least until the base image is updated.
RUN rm -rf /goroot && mkdir /goroot && curl https://storage.googleapis.com/golang/go1.4.2.linux-amd64.tar.gz | tar xvzf - -C /goroot --strip-components=1
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论