gpt4 book ai didi

Go 没有安装 gotype 命令?

转载 作者:数据小太阳 更新时间:2023-10-29 03:07:14 25 4
gpt4 key购买 nike

我从异地获得了 Go 1.4/Win32。我看到文件夹“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通过 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 没有安装 gotype 命令?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27768974/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com