golangdoc.translations icon indicating copy to clipboard operation
golangdoc.translations copied to clipboard

golangdoc -http=:6060 -lang=zh_CN 执行出错,求助,谢谢。

Open guoqiang1982 opened this issue 7 years ago • 7 comments

过程如下: 首先按照说明成功的执行了go get github.com/golang-china/golangdoc,生成了golangdoc可执行文件, 然后下载golangdoc.translations:

  1. 如果将下载的文件放到$GOROOT下,产生类似如下的信息: 。。。。。。 goroutine 781 [runnable]: github.com/golang-china/golangdoc/godoc.(*treeBuilder).newDirTree.func1(0xc0424a4060, 0xc04202fed0, 0xc042031b00, 0xc04255ec00, 0x11, 0x2, 0xe1f5c0, 0xc0423ae720) D:/Go/src/github.com/golang-china/golangdoc/godoc/dirtrees.go:98 created by github.com/golang-china/golangdoc/godoc.(*treeBuilder).newDirTree D:/Go/src/github.com/golang-china/golangdoc/godoc/dirtrees.go:98 +0x61d

goroutine 782 [runnable]: github.com/golang-china/golangdoc/godoc.(*treeBuilder).newDirTree.func1(0xc0424a40c0, 0xc04202fed0, 0xc042031b00, 0xc04255ec00, 0x11, 0x2, 0xe1f5c0, 0xc042664060) D:/Go/src/github.com/golang-china/golangdoc/godoc/dirtrees.go:98 created by github.com/golang-china/golangdoc/godoc.(*treeBuilder).newDirTree D:/Go/src/github.com/golang-china/golangdoc/godoc/dirtrees.go:98 +0x61d

goroutine 783 [runnable]: github.com/golang-china/golangdoc/godoc.(*treeBuilder).newDirTree.func1(0xc0424a4120, 0xc04202fed0, 0xc042031b00, 0xc04255ec00, 0x11, 0x2, 0xe1f5c0, 0xc042664180) D:/Go/src/github.com/golang-china/golangdoc/godoc/dirtrees.go:98 created by github.com/golang-china/golangdoc/godoc.(*treeBuilder).newDirTree D:/Go/src/github.com/golang-china/golangdoc/godoc/dirtrees.go:98 +0x61d

goroutine 784 [runnable]: github.com/golang-china/golangdoc/godoc.(*treeBuilder).newDirTree.func1(0xc0424a4180, 0xc04202fed0, 0xc042031b00, 0xc04255ec00, 0x11, 0x2, 0xe1f5c0, 0xc0426641e0) D:/Go/src/github.com/golang-china/golangdoc/godoc/dirtrees.go:98 created by github.com/golang-china/golangdoc/godoc.(*treeBuilder).newDirTree D:/Go/src/github.com/golang-china/golangdoc/godoc/dirtrees.go:98 +0x61d 。。。。。。 http://127.0.0.1:6060/doc无法访问 2. 如果将下载的文件放到$GOPATH下,产生如下错误信息: 2018/03/29 09:45:04 readTemplate: template: godoc.html:82: function "srcBreadcrumb" not defined http://127.0.0.1:6060/doc还是无法访问 请帮忙解答一下,谢谢

guoqiang1982 avatar Mar 29 '18 02:03 guoqiang1982

通常这是由于各种环境变量影响造成的, 你可以先试试

golangdoc  --help

你会发现一个参数

-godoc-local-root string
    	Godoc translations root, default is $(GOROOT)/translations

比如

golangdoc -http=:6060 -godoc-local-root /path/to/translations

先这样测试下, 如果正常(我刚测试通过)那就是环境变量问题了. 如果你想查出具体问题, 请贴出 go env 结果, 更具体的解答可能需要柴大来.

achun avatar Mar 29 '18 05:03 achun

我的translations是放在 /usr/local/go/下的,执行如下命令: golangdoc -http=:6060 -godoc-local-root /usr/local/go/translations 还是会报相同的错: readTemplate: template: godoc.html:82: function "srcBreadcrumb" not defined

woorui avatar May 06 '18 13:05 woorui

srcBreadcrumb 这个词从来没有出现过, 无论是官方的,还是翻译的, 还是历史, 都没有. 你的 godoc.html:82 怎么会有这个词?

achun avatar May 06 '18 14:05 achun

我翻了下代码,也没有找到srcBreadcrumb这个词,我把golangdoc重新安装了一遍,问题依旧存在 macOS : 10.13.4 (17E202) go version: go1.10.2 darwin/amd64 @achun

woorui avatar May 06 '18 14:05 woorui

我删掉了 golangdoc 和 golangdoc.translations 从头来了一遍. 并没有出现 srcBreadcrumb not defined 的问题, 不过确实有其他问题. 加上 -lang=zh_CN 会报错, 不加的话出来是英文的, 而且 /pkg/ 的内容出不来, 控制台提示:

2018/05/06 23:33:59 cannot find package "." in:
	/src

我先通知 @chai2010 下.

achun avatar May 06 '18 15:05 achun

各位, 我临时更新了下 https://gohub.github.io/ 提供在线 Golang 文档阅读

只是实现基础功能, 基本可用

achun avatar May 21 '18 08:05 achun

golangdoc -http=:6060 -godoc-local-root /usr/local/go/translations 还是会报相同的错: readTemplate: template: godoc.html:82: function "srcBreadcrumb" not defined 同上问题

lucky-xiaogan avatar Sep 03 '18 06:09 lucky-xiaogan