如何使用`godoc -http=:6060`显示内置类型?

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

How to show builtin types using `godoc -http=:6060`?

问题

如果我运行

godoc -http=:6060

然后打开 http://localhost:6060/pkg/builtin/#string(例如,通过在某个地方使用 string 作为类型的函数声明),我会得到一个大大的红色提示:“open /usr/local/Cellar/go/1.3.3/libexec/src/builtin: no such file or directory”。

我该如何让godoc像http://golang.org/pkg/builtin/#string一样工作?

我尝试过 go get builtin,但没有改变任何东西。DuckDuckGo和Google搜索也没有给我提供任何启示。

(我在OS X上使用Homebrew安装了Go。)

英文:

If I start

godoc -http=:6060

and then open http://localhost:6060/pkg/builtin/#string (e.g. via a function declaration that uses string as a type somewhere), I get a big red "open /usr/local/Cellar/go/1.3.3/libexec/src/builtin: no such file or directory".

How do I get godoc to work the same way as http://golang.org/pkg/builtin/#string ?

I tried go get builtin, but that did not change anything. And DuckDuckGo and Google searches did not illuminate me either.

(I've installed Go using Homebrew on OS X.)

答案1

得分: 3

Godoc最近进行了更新,以适应Go 1.4的新内部布局。

在1.4之前,系统包放在$GOROOT/src/pkg/目录下,而在1.4(当前的开发版本)中,它们被移动到了$GOROOT/src目录下。

要获取与1.4之前版本兼容的版本,请执行以下操作:

cd $GOPATH/src/code.google.com/p/go.tools/cmd/godoc
hg checkout -C release-branch.go1.3
go install
英文:

Godoc was updated recently to match the new internal layout of Go 1.4.

Prior to 1.4, system packages went into $GOROOT/src/pkg/, in 1.4 (current dev version) they moved to$GOROOT/src.

To get the pre-1.4 compatible version:

cd $GOPATH/src/code.google.com/p/go.tools/cmd/godoc
hg checkout -C release-branch.go1.3
go install

huangapple
  • 本文由 发表于 2014年10月4日 18:14:28
  • 转载请务必保留本文链接:https://go.coder-hub.com/26191798.html
匿名

发表评论

匿名网友

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

确定