构建Go应用程序失败:…:找不到导入项:”code.google.com/p/go.net/html”

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

Failed to build Go application: ... : can't find import: "code.google.com/p/go.net/html

问题

我刚刚尝试在Google App Engine上启动一个应用程序(https://github.com/mjibson/goread)。

我按照所有步骤进行操作,但当我到达应该使用dev_appserver.py app.yaml启动它的步骤时,我遇到了以下错误:

  1. $ dev_appserver.py app.yaml
  2. INFO 2013-11-27 17:14:13,250 sdk_update_checker.py:245] Checking for updates to the SDK.
  3. INFO 2013-11-27 17:14:13,446 sdk_update_checker.py:273] The SDK is up to date.
  4. WARNING 2013-11-27 17:14:13,455 api_server.py:331] Could not initialize images API; you are likely missing the Python "PIL" module.
  5. INFO 2013-11-27 17:14:13,460 api_server.py:138] Starting API server at: http://localhost:42131
  6. INFO 2013-11-27 17:14:13,532 dispatcher.py:171] Starting module "default" running at: http://localhost:8080
  7. INFO 2013-11-27 17:14:13,535 admin_server.py:117] Starting admin server at: http://localhost:8000
  8. ERROR 2013-11-27 17:14:16,293 go_runtime.py:166] Failed to build Go application:
  9. 2013/11/27 17:14:16 go-app-builder: build timing: 10×6g (2.35416362s total), 18×gopack (104.629743ms total), 0×6l (0 total)
  10. 2013/11/27 17:14:16 go-app-builder: failed running 6g: signal: killed
  11. (Executed command: /home/ubuntu/bin/go_appengine/goroot/bin/go-app-builder -app_base /home/ubuntu/mygo/src/github.com/mjibson/goread -arch 6 -binary_name _go_app -dynamic -extra_import$
  12. appengine_internal/init -goroot /home/ubuntu/bin/go_appengine/goroot -nobuild_files ^^$ -unsafe -work_dir /tmp/tmpJex0GQappengine-go-bin -gcflags -I,/home/ubuntu/bin/go_appengine/goroo
  13. t/pkg/linux_amd64_appengine -ldflags -L,/home/ubuntu/bin/go_appengine/goroot/pkg/linux_amd64_appengine -gopath /home/ubuntu/mygo sanitizer/sanitize.go rdf/rdf.go rss/rss.go types.go fun
  14. cs.go utils.go settings.go atom/atom.go sanitizer/strip.go main.go admin.go charge.go user.go autodiscover.go sanitizer/snip.go tasks.go)
  15. ^CINFO 2013-11-27 17:14:18,348 shutdown.py:44] Shutting down.
  16. INFO 2013-11-27 17:14:18,375 api_server.py:524] Applying all pending transactions and saving the datastore
  17. INFO 2013-11-27 17:14:18,375 api_server.py:527] Saving search indexes

使用sudo时,错误部分发生了变化:

> ERROR 2013-11-27 15:04:50,576 go_runtime.py:166] Failed to build Go
> application:
> /home/ubuntu/mygo/src/github.com/mjibson/goread/sanitizer/sanitize.go:21:
> can't find import: "code.google.com/p/go.net/html"

引起问题的代码行:

package sanitizer

  1. 17 package sanitizer
  2. 18
  3. 19 import (
  4. 20 "bytes"
  5. 21 "code.google.com/p/go.net/html"
  6. 22 "io"
  7. 23 "net/url"
  8. 24 "strings"
  9. 25 )

这是我的Go环境:

  1. $ goapp env
  2. GOARCH="amd64"
  3. GOBIN=""
  4. GOCHAR="6"
  5. GOEXE=""
  6. GOHOSTARCH="amd64"
  7. GOHOSTOS="linux"
  8. GOOS="linux"
  9. GOPATH="/home/ubuntu/mygo"
  10. GORACE=""
  11. GOROOT="/home/ubuntu/bin/go_appengine/goroot"
  12. GOTOOLDIR="/home/ubuntu/bin/go_appengine/goroot/pkg/tool/linux_amd64"
  13. CC="gcc"
  14. GOGCCFLAGS="-g -O2 -fPIC -m64 -pthread"
  15. CGO_ENABLED="1"
  16. $ ll ~/bin/
  17. Nov 27 14:34 appcfg.py -> go_appengine/appcfg.py*
  18. Nov 27 14:34 dev_appserver.py -> go_appengine/dev_appserver.py*
  19. Nov 18 01:36 go_appengine/
  20. Nov 27 14:35 goapp -> go_appengine/goapp*
  21. /home/ubuntu/mygo/pkg/
  22. └── linux_amd64_appengine
  23. └── code.google.com
  24. └── p
  25. └── go.net
  26. ├── html
  27. │   └── atom.a
  28. └── html.a
  29. /home/ubuntu/mygo/src/
  30. ├── code.google.com
  31. │   └── p
  32. │   ├── go-charset
  33. │   │   ├── charset
  34. │   │   ├── cmd
  35. │   │   ├── data
  36. │   │   ├── datafiles
  37. │   │   └── lib
  38. │   └── go.net
  39. │   ├── dict
  40. │   ├── html
  41. │   ├── idna
  42. │   ├── ipv4
  43. │   ├── ipv6
  44. │   ├── netutil
  45. │   ├── proxy
  46. │   ├── publicsuffix
  47. │   ├── spdy
  48. │   └── websocket
  49. └── github.com
  50. ├── gorilla
  51. │   ├── context
  52. │   └── mux
  53. ├── MiniProfiler
  54. │   └── go
  55. │   ├── example
  56. │   ├── miniprofiler
  57. │   ├── miniprofiler_gae
  58. │   ├── miniprofiler_revel
  59. │   ├── redis
  60. │   ├── sql
  61. │   └── ui
  62. └── mjibson
  63. ├── appstats
  64. │   └── static
  65. ├── goon
  66. └── goread
  67. ├── atom
  68. ├── rdf
  69. ├── rss
  70. ├── sanitizer
  71. ├── static
  72. └── templates

App Engine版本:linux_amd64-1.8.8

编辑

现在我遇到了以下错误:
ERROR 2013-11-28 02:11:38,201 go_runtime.py:166] Failed to build Go application: /home/ubuntu/mygo/src/github.com/MiniProfiler/go/miniprofiler/static.go:19263: out of memory

尽管在运行此命令时,我的机器上有大约480M的可用RAM。

编辑

我已经测试过,似乎我要运行它的机器上的RAM不足(免费的Amazon实例),因为在我的本地机器上它运行得很顺利,以下是htop的摘要:

  1. VIRT RES SHR S CPU% MEM% TIME+ Command
  2. 1492M 88588 5804 S 0.0 1.5 0:14.72 python /home/XXXX/bin/dev_appserver.py app.yaml
英文:

I have just attempted to launch an application (https://github.com/mjibson/goread) on google app engine.

I have followed all the steps but when I get to the point where I should launch it with dev_appserver.py app.yaml I am getting the following error :

  1. $ dev_appserver.py app.yaml
  2. INFO 2013-11-27 17:14:13,250 sdk_update_checker.py:245] Checking for updates to the SDK.
  3. INFO 2013-11-27 17:14:13,446 sdk_update_checker.py:273] The SDK is up to date.
  4. WARNING 2013-11-27 17:14:13,455 api_server.py:331] Could not initialize images API; you are likely missing the Python "PIL" module.
  5. INFO 2013-11-27 17:14:13,460 api_server.py:138] Starting API server at: http://localhost:42131
  6. INFO 2013-11-27 17:14:13,532 dispatcher.py:171] Starting module "default" running at: http://localhost:8080
  7. INFO 2013-11-27 17:14:13,535 admin_server.py:117] Starting admin server at: http://localhost:8000
  8. ERROR 2013-11-27 17:14:16,293 go_runtime.py:166] Failed to build Go application:
  9. 2013/11/27 17:14:16 go-app-builder: build timing: 10×6g (2.35416362s total), 18×gopack (104.629743ms total), 0×6l (0 total)
  10. 2013/11/27 17:14:16 go-app-builder: failed running 6g: signal: killed
  11. (Executed command: /home/ubuntu/bin/go_appengine/goroot/bin/go-app-builder -app_base /home/ubuntu/mygo/src/github.com/mjibson/goread -arch 6 -binary_name _go_app -dynamic -extra_import$
  12. appengine_internal/init -goroot /home/ubuntu/bin/go_appengine/goroot -nobuild_files ^^$ -unsafe -work_dir /tmp/tmpJex0GQappengine-go-bin -gcflags -I,/home/ubuntu/bin/go_appengine/goroo
  13. t/pkg/linux_amd64_appengine -ldflags -L,/home/ubuntu/bin/go_appengine/goroot/pkg/linux_amd64_appengine -gopath /home/ubuntu/mygo sanitizer/sanitize.go rdf/rdf.go rss/rss.go types.go fun
  14. cs.go utils.go settings.go atom/atom.go sanitizer/strip.go main.go admin.go charge.go user.go autodiscover.go sanitizer/snip.go tasks.go)
  15. ^CINFO 2013-11-27 17:14:18,348 shutdown.py:44] Shutting down.
  16. INFO 2013-11-27 17:14:18,375 api_server.py:524] Applying all pending transactions and saving the datastore
  17. INFO 2013-11-27 17:14:18,375 api_server.py:527] Saving search indexes

With sudo only the error part change :

> ERROR 2013-11-27 15:04:50,576 go_runtime.py:166] Failed to build Go
> application:
> /home/ubuntu/mygo/src/github.com/mjibson/goread/sanitizer/sanitize.go:21:
> can't find import: "code.google.com/p/go.net/html"

The lines causing problems :

package sanitizer

  1. 17 package sanitizer
  2. 18
  3. 19 import (
  4. 20 "bytes"
  5. 21 "code.google.com/p/go.net/html"
  6. 22 "io"
  7. 23 "net/url"
  8. 24 "strings"
  9. 25 )

This is my go environment :

  1. $ goapp env
  2. GOARCH="amd64"
  3. GOBIN=""
  4. GOCHAR="6"
  5. GOEXE=""
  6. GOHOSTARCH="amd64"
  7. GOHOSTOS="linux"
  8. GOOS="linux"
  9. GOPATH="/home/ubuntu/mygo"
  10. GORACE=""
  11. GOROOT="/home/ubuntu/bin/go_appengine/goroot"
  12. GOTOOLDIR="/home/ubuntu/bin/go_appengine/goroot/pkg/tool/linux_amd64"
  13. CC="gcc"
  14. GOGCCFLAGS="-g -O2 -fPIC -m64 -pthread"
  15. CGO_ENABLED="1"
  16. $ ll ~/bin/
  17. Nov 27 14:34 appcfg.py -> go_appengine/appcfg.py*
  18. Nov 27 14:34 dev_appserver.py -> go_appengine/dev_appserver.py*
  19. Nov 18 01:36 go_appengine/
  20. Nov 27 14:35 goapp -> go_appengine/goapp*
  21. /home/ubuntu/mygo/pkg/
  22. └── linux_amd64_appengine
  23. └── code.google.com
  24. └── p
  25. └── go.net
  26. ├── html
  27. │   └── atom.a
  28. └── html.a
  29. /home/ubuntu/mygo/src/
  30. ├── code.google.com
  31. │   └── p
  32. │   ├── go-charset
  33. │   │   ├── charset
  34. │   │   ├── cmd
  35. │   │   ├── data
  36. │   │   ├── datafiles
  37. │   │   └── lib
  38. │   └── go.net
  39. │   ├── dict
  40. │   ├── html
  41. │   ├── idna
  42. │   ├── ipv4
  43. │   ├── ipv6
  44. │   ├── netutil
  45. │   ├── proxy
  46. │   ├── publicsuffix
  47. │   ├── spdy
  48. │   └── websocket
  49. └── github.com
  50. ├── gorilla
  51. │   ├── context
  52. │   └── mux
  53. ├── MiniProfiler
  54. │   └── go
  55. │   ├── example
  56. │   ├── miniprofiler
  57. │   ├── miniprofiler_gae
  58. │   ├── miniprofiler_revel
  59. │   ├── redis
  60. │   ├── sql
  61. │   └── ui
  62. └── mjibson
  63. ├── appstats
  64. │   └── static
  65. ├── goon
  66. └── goread
  67. ├── atom
  68. ├── rdf
  69. ├── rss
  70. ├── sanitizer
  71. ├── static
  72. └── templates

App engine version : linux_amd64-1.8.8

EDIT

  1. Now I am getting
  2. ERROR 2013-11-28 02:11:38,201 go_runtime.py:166] Failed to build Go application: /home/ubuntu/mygo/src/github.com/MiniProfiler/go/miniprofiler/static.go:19263: out of memory

ALthough I have like 480M of free RAM on my machine while running this command.

EDIT

I have tested and seems that there is not enough RAM on the machine that I wanted to run it on (free tier amazon instance) because it runs smoothly on my local machine with the following htop summary

  1. VIRT RES SHR S CPU% MEM% TIME+ Command
  2. 1492M 88588 5804 S 0.0 1.5 0:14.72 python /home/XXXX/bin/dev_appserver.py app.yaml

答案1

得分: 0

我已经测试过了,似乎我想要运行的机器(免费的亚马逊实例)上的内存不足,因为在我本地的机器上(拥有6GB的内存)它运行得很顺利。

英文:

I have tested and seems that there is not enough RAM on the machine that I wanted to run it on (free tier amazon instance) because it runs smoothly on my local machine with 6 GB of RAM.

huangapple
  • 本文由 发表于 2013年11月28日 00:18:01
  • 转载请务必保留本文链接:https://go.coder-hub.com/20247599.html
匿名

发表评论

匿名网友

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

确定