无法构建Go应用程序:…:找不到导入:“ code.google.com/p/go.net/html

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 :

$ dev_appserver.py app.yaml                                                                                                   
INFO     2013-11-27 17:14:13,250 sdk_update_checker.py:245] Checking for updates to the SDK.
INFO     2013-11-27 17:14:13,446 sdk_update_checker.py:273] The SDK is up to date.
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.
INFO     2013-11-27 17:14:13,460 api_server.py:138] Starting API server at: http://localhost:42131
INFO     2013-11-27 17:14:13,532 dispatcher.py:171] Starting module "default" running at: http://localhost:8080
INFO     2013-11-27 17:14:13,535 admin_server.py:117] Starting admin server at: http://localhost:8000
ERROR    2013-11-27 17:14:16,293 go_runtime.py:166] Failed to build Go application: 
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)
2013/11/27 17:14:16 go-app-builder: failed running 6g: signal: killed


(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$
 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
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
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)
^CINFO     2013-11-27 17:14:18,348 shutdown.py:44] Shutting down.
INFO     2013-11-27 17:14:18,375 api_server.py:524] Applying all pending transactions and saving the datastore
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

 17 package sanitizer
 18 
 19 import (
 20         "bytes"
 21         "code.google.com/p/go.net/html"
 22         "io"
 23         "net/url"
 24         "strings"
 25 )

This is my go environment :

$ goapp env
GOARCH="amd64"
GOBIN=""
GOCHAR="6"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/ubuntu/mygo"
GORACE=""
GOROOT="/home/ubuntu/bin/go_appengine/goroot"
GOTOOLDIR="/home/ubuntu/bin/go_appengine/goroot/pkg/tool/linux_amd64"
CC="gcc"
GOGCCFLAGS="-g -O2 -fPIC -m64 -pthread"
CGO_ENABLED="1"

$ ll ~/bin/
Nov 27 14:34 appcfg.py -> go_appengine/appcfg.py*
Nov 27 14:34 dev_appserver.py -> go_appengine/dev_appserver.py*
Nov 18 01:36 go_appengine/
Nov 27 14:35 goapp -> go_appengine/goapp*

/home/ubuntu/mygo/pkg/
└── linux_amd64_appengine
    └── code.google.com
        └── p
            └── go.net
                ├── html
                │   └── atom.a
                └── html.a
/home/ubuntu/mygo/src/
├── code.google.com
│   └── p
│       ├── go-charset
│       │   ├── charset
│       │   ├── cmd
│       │   ├── data
│       │   ├── datafiles
│       │   └── lib
│       └── go.net
│           ├── dict
│           ├── html
│           ├── idna
│           ├── ipv4
│           ├── ipv6
│           ├── netutil
│           ├── proxy
│           ├── publicsuffix
│           ├── spdy
│           └── websocket
└── github.com
    ├── gorilla
    │   ├── context
    │   └── mux
    ├── MiniProfiler
    │   └── go
    │       ├── example
    │       ├── miniprofiler
    │       ├── miniprofiler_gae
    │       ├── miniprofiler_revel
    │       ├── redis
    │       ├── sql
    │       └── ui
    └── mjibson
        ├── appstats
        │   └── static
        ├── goon
        └── goread
            ├── atom
            ├── rdf
            ├── rss
            ├── sanitizer
            ├── static
            └── templates

App engine version : linux_amd64-1.8.8

EDIT

Now I am getting 
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

 VIRT   RES   SHR S CPU% MEM%   TIME+  Command
1492M 88588  5804 S  0.0  1.5  0:14.72 python /home/XXXX/bin/dev_appserver.py app.yaml
doubi8512
doubi8512 我认为在以sudo身份运行时找不到该软件包是有希望的:您的gopath可能对超级用户不可读。
接近 7 年之前 回复
donglun4521
donglun4521 嗨,您好。好吧,我尝试在我的机器上本地运行它,并且可以正常运行。我尝试将pkg文件夹复制到另一台机器,但是即使在显式的goapp构建上也无法正常工作(相同的输出)
接近 7 年之前 回复
dongtaochan0777
dongtaochan0777 Miniprofiler和appstats包含巨大的静态内容字节数组,因此在编译期间会占用大量内存-这可能会导致OOM错误。除此之外,您现在还有其他错误吗?我认为这里没有真正的问题。
接近 7 年之前 回复
dongqin5604
dongqin5604 我已经用整个错误消息更新了答案。appengine版本为linux_amd64-1.8.8
接近 7 年之前 回复
dongzhidian3538
dongzhidian3538 除了您复制的内容以外,dev_appserver.py还有更多输出吗?您正在运行哪个版本的SDK?
接近 7 年之前 回复
dsq1982
dsq1982 通常,如果gopath包含必需的软件包,则可以进行编译而不会出现任何问题。现在,我唯一的猜测是,它正在寻找该软件包的其他途径。您可以检查该工具是否有指向其他路径或其他目录结构的配置文件?
接近 7 年之前 回复
doumiang2297
doumiang2297 我可以获取它们,但仍然可以按照上一命令ls/home/ubuntu/mygo/src/code.google.com/p/go.net/html/
接近 7 年之前 回复
duanhuizhe6767
duanhuizhe6767 我知道,我想您也需要获取该程序包,它必须是框架中的那些程序包之一,但必须移至单独的存储库(如bcrypt和其他程序包)中。由于您使用的工具类似于“goget”,因此请尝试通过以下方式获取该软件包:goappgetcode.google.com/p/go.net/html。让我知道发生什么事。
接近 7 年之前 回复
doulian8742
doulian8742 我从github上获得它(我认为该项目需要来自code.google.com的某些依赖项)。我仍然不使用goget但使用goappget-dgithub.com/mjibson/goread。
接近 7 年之前 回复
dongpeiwei8589
dongpeiwei8589 那么,您是从github或code.google.com获得该软件包的吗?因为如果您在导入中使用该软件包,则应该在“pkg/src”文件夹中以完全相同的结构保存这些文件。我会说从github做一个新的“获取”并尝试再次编译,但是在此之前,请删除gopath中当前导入的包
接近 7 年之前 回复

1个回答



我已经测试过,似乎机器上没有足够的RAM来运行它(免费的Amazon实例),因为 它可以在具有6 GB RAM的本地计算机上顺利运行。</ p>
</ div>

展开原文

原文

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.

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐