我对导入所需的包感到非常困惑,因为所有的文件都被nobuild_files排除了。

huangapple go评论94阅读模式
英文:

I'm really confused with importing required packages but all its files were excluded by nobuild_files

问题

我已经安装了最新的工具,在app.go中我有以下导入:

"github.com/go-martini/martini"
"github.com/martini-contrib/binding"
"github.com/martini-contrib/render"
"github.com/moovweb/gokogiri"
"github.com/moovweb/gokogiri/xml"

app.yaml中:

application: app
version: 1
runtime: go
api_version: go1

handlers:
- url: /.*
  script: _go_app

我使用godep save工具保存了外部依赖项。但是在尝试执行goapp serve命令时出现以下错误:

SRSLY-2:app bezigon$ goapp serve
INFO     2015-05-27 09:11:22,645 devappserver2.py:745] Skipping SDK update check.
INFO     2015-05-27 09:11:23,048 api_server.py:190] Starting API server at: http://localhost:57449
INFO     2015-05-27 09:11:23,071 dispatcher.py:192] Starting module "default" running at: http://localhost:8080
INFO     2015-05-27 09:11:23,073 admin_server.py:118] Starting admin server at: http://localhost:8000
ERROR    2015-05-27 09:11:24,772 go_runtime.py:180] Failed to build Go application: (Executed command: /Users/bezigon/google-cloud-sdk/platform/google_appengine/goroot/bin/go-app-builder -app_base /Users/bezigon/go/src/github.com/bezigon/app -arch 6 -dynamic -goroot /Users/bezigon/google-cloud-sdk/platform/google_appengine/goroot -nobuild_files ^^$ -unsafe -gopath /Users/bezigon/go -print_extras_hash Godeps/_workspace/src/github.com/moovweb/gokogiri/html/xpath_test.go Godeps/_workspace/src/github.com/martini-contrib/binding/validate_test.go Godeps/_workspace/src/github.com/moovweb/gokogiri/xml/attribute.go Godeps/_workspace/src/github.com/martini-contrib/binding/file_test.go Godeps/_workspace/src/github.com/moovweb/gokogiri/xml/document_test.go Godeps/_workspace/src/github.com/moovweb/gokogiri/xpath/util.go Godeps/_workspace/src/github.com/go-martini/martini/logger.go Godeps/_workspace/src/github.com/martini-contrib/binding/misc_test.go Godeps/_workspace/src/github.com/go-martini/martini/response_writer_test.go Godeps/_workspace/src/github.com/codegangsta/inject/inject_test.go Godeps/_workspace/src/github.com/moovweb/gokogiri/xml/text.go Godeps/_workspace/src/github.com/go-martini/martini/go_version.go Godeps/_workspace/src/github.com/go-martini/martini/router_test.go Godeps/_workspace/src/github.com/moovweb/gokogiri/xml/nodeset.go Godeps/_workspace/src/github.com/moovweb/gokogiri/xpath/xpath_test.go Godeps/_workspace/src/github.com/moovweb/gokogiri/xpath/xpath.go Godeps/_workspace/src/github.com/martini-contrib/binding/errors.go Godeps/_workspace/src/github.com/moovweb/gokogiri/mem/mem_test.go Godeps/_workspace/src/github.com/moovweb/gokogiri/help/help_test.go Godeps/_workspace/src/github.com/moovweb/gokogiri/html/fragment_test.go Godeps/_workspace/src/github.com/moovweb/gokogiri/html/node_test.go Godeps/_workspace/src/github.com/martini-contrib/render/render.go Godeps/_workspace/src/github.com/moovweb/gokogiri/help/help.go Godeps/_workspace/src/github.com/moovweb/gokogiri/mem/mem.go Godeps/_workspace/src/github.com/go-martini/martini/recovery.go Godeps/_workspace/src/github.com/moovweb/gokogiri/xml/document.go Godeps/_workspace/src/github.com/moovweb/gokogiri/html/document.go Godeps/_workspace/src/github.com/moovweb/gokogiri/gokogiri.go Godeps/_workspace/src/github.com/moovweb/gokogiri/xml/element.go Godeps/_workspace/src/github.com/martini-contrib/binding/errors_test.go Godeps/_workspace/src/github.com/moovweb/gokogiri/util/util_test.go Godeps/_workspace/src/github.com/moovweb/gokogiri/xml/fragment.go Godeps/_workspace/src/github.com/moovweb/gokogiri/xml/attribute_test.go Godeps/_workspace/src/github.com/moovweb/gokogiri/css/css_test.go Godeps/_workspace/src/github.com/oxtoacart/bpool/bytepool.go Godeps/_workspace/src/github.com/moovweb/gokogiri/xml/fragment_test.go Godeps/_workspace/src/github.com/martini-contrib/binding/errorhandler_test.go Godeps/_workspace/src/github.com/moovweb/gokogiri/xml/utils_test.go Godeps/_workspace/src/github.com/oxtoacart/bpool/bpool.go Godeps/_workspace/src/github.com/moovweb/gokogiri/util/util.go Godeps/_workspace/src/github.com/moovweb/gokogiri/html/utils_test.go Godeps/_workspace/src/github.com/go-martini/martini/response_writer.go Godeps/_workspace/src/github.com/moovweb/gokogiri/css/css.go Godeps/_workspace/src/github.com/go-martini/martini/env.go Godeps/_workspace/src/github.com/moovweb/gokogiri/xml/search_test.go Godeps/_workspace/src/github.com/moovweb/gokogiri/gokogiri_test.go Godeps/_workspace/src/github.com/go-martini/martini/static_test.go Godeps/_workspace/src/github.com/codegangsta/inject/inject.go Godeps/_workspace/src/github.com/moovweb/gokogiri/xpath/expression.go Godeps/_workspace/src/github.com/martini-contrib/binding/form_test.go Godeps/_workspace/src/github.com/go-martini/martini/static.go Godeps/_workspace/src/github.com/go-martini/martini/martini.go Godeps/_workspace/src/github.com/moovweb/gokogiri/html/fragment.go Godeps/_workspace/src/github.com/martini-contrib/binding/bind_test.go app.go Godeps/_workspace/src/github.com/martini-contrib/render/render_test.go Godeps/_workspace/src/github.com/martini-contrib/binding/binding.go Godeps/_workspace/src/github.com/moovweb/gokogiri/xml/cdata.go Godeps/_workspace/src/github.com/go-martini/martini/martini_test.go Godeps/_workspace/src/github.com/moovweb/gokogiri/xml/node_test.go Godeps/_workspace/src/github.com/oxtoacart/bpool/bufferpool.go Godeps/_workspace/src/github.com/martini-contrib/binding/json_test.go Godeps/_workspace/src/github.com/moovweb/gokogiri/xpath/util_test.go Godeps/_workspace/src/github.com/go-martini/martini/router.go Godeps/_workspace/src/github.com/martini-contrib/binding/common_test.go Godeps/_workspace/src/github.com/moovweb/gokogiri/xml/pi.go Godeps/_workspace/src/github.com/go-martini/martini/logger_test.go Godeps/_workspace/src/github.com/go-martini/martini/recovery_test.go Godeps/_workspace/src/github.com/go-martini/martini/return_handler.go Godeps/_workspace/src/github.com/moovweb/gokogiri/help/util_test.go Godeps/_workspace/src/github.com/moovweb/gokogiri/html/document_test.go Godeps/_workspace/src/github.com/moovweb/gokogiri/html/crash_test.go Godeps/_workspace/src/github.com/moovweb/gokogiri/xml/comment.go Godeps/_workspace/src/github.com/martini-contrib/binding/multipart_test.go Godeps/_workspace/src/github.com/moovweb/gokogiri/xml/node.go Godeps/_workspace/src/github.com/go-martini/martini/env_test.go Godeps/_workspace/src/github.com/moovweb/gokogiri/html/encoding_test.go)

2015/05/27 12:11:24 go-app-builder: Failed parsing input: package github.com/moovweb/gokogiri/html required, but all its files were excluded by nobuild_files

我该怎么办?

顺便说一下,看起来像是https://blog.golang.org/the-app-engine-sdk-and-workspaces-gopath,但我没有找到答案。

更新:我添加了一个测试用例,请查看https://github.com/bezigon/testcase

英文:

I have latest tools installed, in the app.go I have following imports

"github.com/go-martini/martini"
"github.com/martini-contrib/binding"
"github.com/martini-contrib/render"
"github.com/moovweb/gokogiri"
"github.com/moovweb/gokogiri/xml"

And in app.yaml

application: app
version: 1
runtime: go
api_version: go1

handlers:
- url: /.*
  script: _go_app

I saved external dependencies using godep save tool. But while trying to execute goapp serve command following error occured

SRSLY-2:app bezigon$ goapp serve
INFO     2015-05-27 09:11:22,645 devappserver2.py:745] Skipping SDK update check.
INFO     2015-05-27 09:11:23,048 api_server.py:190] Starting API server at: http://localhost:57449
INFO     2015-05-27 09:11:23,071 dispatcher.py:192] Starting module "default" running at: http://localhost:8080
INFO     2015-05-27 09:11:23,073 admin_server.py:118] Starting admin server at: http://localhost:8000
ERROR    2015-05-27 09:11:24,772 go_runtime.py:180] Failed to build Go application: (Executed command: /Users/bezigon/google-cloud-sdk/platform/google_appengine/goroot/bin/go-app-builder -app_base /Users/bezigon/go/src/github.com/bezigon/app -arch 6 -dynamic -goroot /Users/bezigon/google-cloud-sdk/platform/google_appengine/goroot -nobuild_files ^^$ -unsafe -gopath /Users/bezigon/go -print_extras_hash Godeps/_workspace/src/github.com/moovweb/gokogiri/html/xpath_test.go Godeps/_workspace/src/github.com/martini-contrib/binding/validate_test.go Godeps/_workspace/src/github.com/moovweb/gokogiri/xml/attribute.go Godeps/_workspace/src/github.com/martini-contrib/binding/file_test.go Godeps/_workspace/src/github.com/moovweb/gokogiri/xml/document_test.go Godeps/_workspace/src/github.com/moovweb/gokogiri/xpath/util.go Godeps/_workspace/src/github.com/go-martini/martini/logger.go Godeps/_workspace/src/github.com/martini-contrib/binding/misc_test.go Godeps/_workspace/src/github.com/go-martini/martini/response_writer_test.go Godeps/_workspace/src/github.com/codegangsta/inject/inject_test.go Godeps/_workspace/src/github.com/moovweb/gokogiri/xml/text.go Godeps/_workspace/src/github.com/go-martini/martini/go_version.go Godeps/_workspace/src/github.com/go-martini/martini/router_test.go Godeps/_workspace/src/github.com/moovweb/gokogiri/xml/nodeset.go Godeps/_workspace/src/github.com/moovweb/gokogiri/xpath/xpath_test.go Godeps/_workspace/src/github.com/moovweb/gokogiri/xpath/xpath.go Godeps/_workspace/src/github.com/martini-contrib/binding/errors.go Godeps/_workspace/src/github.com/moovweb/gokogiri/mem/mem_test.go Godeps/_workspace/src/github.com/moovweb/gokogiri/help/help_test.go Godeps/_workspace/src/github.com/moovweb/gokogiri/html/fragment_test.go Godeps/_workspace/src/github.com/moovweb/gokogiri/html/node_test.go Godeps/_workspace/src/github.com/martini-contrib/render/render.go Godeps/_workspace/src/github.com/moovweb/gokogiri/help/help.go Godeps/_workspace/src/github.com/moovweb/gokogiri/mem/mem.go Godeps/_workspace/src/github.com/go-martini/martini/recovery.go Godeps/_workspace/src/github.com/moovweb/gokogiri/xml/document.go Godeps/_workspace/src/github.com/moovweb/gokogiri/html/document.go Godeps/_workspace/src/github.com/moovweb/gokogiri/gokogiri.go Godeps/_workspace/src/github.com/moovweb/gokogiri/xml/element.go Godeps/_workspace/src/github.com/martini-contrib/binding/errors_test.go Godeps/_workspace/src/github.com/moovweb/gokogiri/util/util_test.go Godeps/_workspace/src/github.com/moovweb/gokogiri/xml/fragment.go Godeps/_workspace/src/github.com/moovweb/gokogiri/xml/attribute_test.go Godeps/_workspace/src/github.com/moovweb/gokogiri/css/css_test.go Godeps/_workspace/src/github.com/oxtoacart/bpool/bytepool.go Godeps/_workspace/src/github.com/moovweb/gokogiri/xml/fragment_test.go Godeps/_workspace/src/github.com/martini-contrib/binding/errorhandler_test.go Godeps/_workspace/src/github.com/moovweb/gokogiri/xml/utils_test.go Godeps/_workspace/src/github.com/oxtoacart/bpool/bpool.go Godeps/_workspace/src/github.com/moovweb/gokogiri/util/util.go Godeps/_workspace/src/github.com/moovweb/gokogiri/html/utils_test.go Godeps/_workspace/src/github.com/go-martini/martini/response_writer.go Godeps/_workspace/src/github.com/moovweb/gokogiri/css/css.go Godeps/_workspace/src/github.com/go-martini/martini/env.go Godeps/_workspace/src/github.com/moovweb/gokogiri/xml/search_test.go Godeps/_workspace/src/github.com/moovweb/gokogiri/gokogiri_test.go Godeps/_workspace/src/github.com/go-martini/martini/static_test.go Godeps/_workspace/src/github.com/codegangsta/inject/inject.go Godeps/_workspace/src/github.com/moovweb/gokogiri/xpath/expression.go Godeps/_workspace/src/github.com/martini-contrib/binding/form_test.go Godeps/_workspace/src/github.com/go-martini/martini/static.go Godeps/_workspace/src/github.com/go-martini/martini/martini.go Godeps/_workspace/src/github.com/moovweb/gokogiri/html/fragment.go Godeps/_workspace/src/github.com/martini-contrib/binding/bind_test.go app.go Godeps/_workspace/src/github.com/martini-contrib/render/render_test.go Godeps/_workspace/src/github.com/martini-contrib/binding/binding.go Godeps/_workspace/src/github.com/moovweb/gokogiri/xml/cdata.go Godeps/_workspace/src/github.com/go-martini/martini/martini_test.go Godeps/_workspace/src/github.com/moovweb/gokogiri/xml/node_test.go Godeps/_workspace/src/github.com/oxtoacart/bpool/bufferpool.go Godeps/_workspace/src/github.com/martini-contrib/binding/json_test.go Godeps/_workspace/src/github.com/moovweb/gokogiri/xpath/util_test.go Godeps/_workspace/src/github.com/go-martini/martini/router.go Godeps/_workspace/src/github.com/martini-contrib/binding/common_test.go Godeps/_workspace/src/github.com/moovweb/gokogiri/xml/pi.go Godeps/_workspace/src/github.com/go-martini/martini/logger_test.go Godeps/_workspace/src/github.com/go-martini/martini/recovery_test.go Godeps/_workspace/src/github.com/go-martini/martini/return_handler.go Godeps/_workspace/src/github.com/moovweb/gokogiri/help/util_test.go Godeps/_workspace/src/github.com/moovweb/gokogiri/html/document_test.go Godeps/_workspace/src/github.com/moovweb/gokogiri/html/crash_test.go Godeps/_workspace/src/github.com/moovweb/gokogiri/xml/comment.go Godeps/_workspace/src/github.com/martini-contrib/binding/multipart_test.go Godeps/_workspace/src/github.com/moovweb/gokogiri/xml/node.go Godeps/_workspace/src/github.com/go-martini/martini/env_test.go Godeps/_workspace/src/github.com/moovweb/gokogiri/html/encoding_test.go)

2015/05/27 12:11:24 go-app-builder: Failed parsing input: package github.com/moovweb/gokogiri/html required, but all its files were excluded by nobuild_files

What should I do?

By the way it looks to https://blog.golang.org/the-app-engine-sdk-and-workspaces-gopath, but I have not found the answer.

UPD: I have added a testcase, check it out https://github.com/bezigon/testcase

答案1

得分: 1

以下链接有答案:

https://groups.google.com/d/msg/google-appengine-go/mGuMV4tVR0U/A3qaCau7zY4J

简而言之,原因是
> 在经典 App Engine 上不支持 "cgo"。如果你想构建你的应用程序,你需要在托管的 VM 上使用 Go(在你的 app.yaml 中设置 "vm: true")。
请参阅 https://cloud.google.com/appengine/docs/go/managed-vms/ 获取更多信息。

英文:

Following link has the answer

https://groups.google.com/d/msg/google-appengine-go/mGuMV4tVR0U/A3qaCau7zY4J

Briefly, the reason is
> "cgo" is not supported on classic App Engine. If you want to build your app, you will need to use Go on Managed VMs ("vm: true" in your app.yaml).
Please see https://cloud.google.com/appengine/docs/go/managed-vms/ for more information.

huangapple
  • 本文由 发表于 2015年5月27日 17:33:31
  • 转载请务必保留本文链接:https://go.coder-hub.com/30478485.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定