Go 没有安装 gotype 命令?
gotype command not installed with Go?
我从异地获得了 Go 1.4 / Win32。我看到了 foder "c:\go\bin"。里面没有 gotype
命令。我需要gotype
-- gotype在哪里,如何安装?
2015 年 4 月更新:Go 1.5 应该引入“go doc
”:参见
- review 9227:
cmd/go
,cmd/doc
: 添加“go doc
”
- review 9226:将
doc.go
重命名为 alldocs.go
以准备“go doc
”
Add the new go doc
command to the go command, installed in the tool directory.
usage:
go doc [-u] [package|[package.]symbol[.method]]
原始答案(2015 年 1 月)
你需要:
go get -u golang.org/x/tools/cmd/gotype
这将安装来自 golang.org/x/tools/cmd/gotype
的额外工具:
The gotype
command does syntactic and semantic analysis of Go files and packages like the front-end of a Go compiler.
Errors are reported if the analysis fails; otherwise gotype
is quiet (unless -v
is set).
注意:这不是您可能考虑安装的唯一额外工具,如 this article:
中所示
go get -u golang.org/x/tools/cmd/godoc
go get -u golang.org/x/tools/cmd/vet
go get -u golang.org/x/tools/cmd/goimports
go get -u golang.org/x/tools/cmd/gorename
go get -u golang.org/x/tools/cmd/oracle
go get -u golang.org/x/tools/cmd/gotype
go get -u github.com/golang/lint/golint
注意:Go 1.5 将使该操作更快。
见 commit dc2d64b by Brad Fitzpatrick (bradfitz
):
cmd/go
: cache results of HTTP requests done during meta tag discovery
Previously, running
$ go get -u -v golang.org/x/tools/cmd/godoc
would results in dozens of HTTP requests for:
https://golang.org/x/tools?go-get=1
once per package under x/tools
.
Now it caches the results.
We still end up doing one HTTP request for all the packages under x/tools
, but this reduces the total number of HTTP requests in ~half.
我从异地获得了 Go 1.4 / Win32。我看到了 foder "c:\go\bin"。里面没有 gotype
命令。我需要gotype
-- gotype在哪里,如何安装?
2015 年 4 月更新:Go 1.5 应该引入“go doc
”:参见
- review 9227:
cmd/go
,cmd/doc
: 添加“go doc
” - review 9226:将
doc.go
重命名为alldocs.go
以准备“go doc
”
Add the new
go doc
command to the go command, installed in the tool directory.usage:
go doc [-u] [package|[package.]symbol[.method]]
原始答案(2015 年 1 月)
你需要:
go get -u golang.org/x/tools/cmd/gotype
这将安装来自 golang.org/x/tools/cmd/gotype
的额外工具:
The
gotype
command does syntactic and semantic analysis of Go files and packages like the front-end of a Go compiler.
Errors are reported if the analysis fails; otherwisegotype
is quiet (unless-v
is set).
注意:这不是您可能考虑安装的唯一额外工具,如 this article:
中所示go get -u golang.org/x/tools/cmd/godoc
go get -u golang.org/x/tools/cmd/vet
go get -u golang.org/x/tools/cmd/goimports
go get -u golang.org/x/tools/cmd/gorename
go get -u golang.org/x/tools/cmd/oracle
go get -u golang.org/x/tools/cmd/gotype
go get -u github.com/golang/lint/golint
注意:Go 1.5 将使该操作更快。
见 commit dc2d64b by Brad Fitzpatrick (bradfitz
):
cmd/go
: cache results of HTTP requests done during meta tag discoveryPreviously, running
$ go get -u -v golang.org/x/tools/cmd/godoc
would results in dozens of HTTP requests for:
https://golang.org/x/tools?go-get=1
once per package under
x/tools
.Now it caches the results.
We still end up doing one HTTP request for all the packages underx/tools
, but this reduces the total number of HTTP requests in ~half.