...
运行 格式化

命令文档

There is a suite of programs to build and process Go source code. Instead of being run directly, programs in the suite are usually invoked by the go program.

这是一组用来构建并处理 Go 源码的程序套件。本套件中的程序并不直接运行,而是通过 go 程序来调用。

The most common way to run these programs is as a subcommand of the go program, for instance as go fmt. Run like this, the command operates on complete packages of Go source code, with the go program invoking the underlying binary with arguments appropriate to package-level processing.

运行这些程序最普通的方式就是作为 go 程序的子命令,例如 go fmt。若像这样运行, 该命令就会在Go源码的完整包上进行操作,它使用 go 程序通过适当的实参来调用基本的二进制程序以进行包级处理。

The programs can also be run as stand-alone binaries, with unmodified arguments, using the go tool subcommand, such as go tool vet. This style of invocation allows, for instance, checking a single source file rather than an entire package: go tool vet myprogram.go as compared to go vet mypackage. Some of the commands, such as yacc, are accessible only through the go tool subcommand.

也可作为独立的二进制程序,加上未修改的实参,并使用 go 的 tool 子命令来运行,例如 go tool vet。以下调用风格也是允许的,例如, 检查单个源文件而非整个包:go tool vet myprogram.go 对比于 go vet mypackage。 有一些命令,如 yacc,只能通过 go 的 tool 子命令来访问。

Finally the fmt and godoc commands are installed as regular binaries called gofmt and godoc because they are so often referenced.

最后,fmtdoc 两个命令也作为常规的二进制被安装为 gofmtgodoc,因为它们偶尔会被引用。

Click on the links for more documentation, invocation methods, and usage details.

欲获取更多文档、调用方法及用法详述,请点击以下链接。

Name      Synopsis
go      The go program manages Go source code and runs the other commands listed here. See the command docs for usage details.

cgo      Cgo enables the creation of Go packages that call C code.
cover      Cover is a program for creating and analyzing the coverage profiles generated by "go test -coverprofile".
fix      Fix finds Go programs that use old features of the language and libraries and rewrites them to use newer ones.
fmt      Fmt formats Go packages, it is also available as an independent gofmt command with more general options.
godoc      Godoc extracts and generates documentation for Go packages.
vet      Vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string.
yacc      Yacc is a version of yacc that generates parsers implemented in Go.
名称      简介
go      go 程序管理 Go 源码以及运行其它在此列出的命令。用法详述见命令文档。

cgo      Cgo 使 Go 包的创建能够调用 C 代码。
cover      Cover 用于创建并优化由 "go test -coverprofile" 生成的规模评估。
fix      Fix 发现使用旧语言与库特性的 Go 程序,并使用较新的特性来重写它们。
fmt      Fmt 格式化 Go 包,它作为独立的gofmt命令,使用更一般的选项同样有效。
godoc      Godoc 从 Go 包中提取并生成文档。
vet      Vet 检查 Go 源码并报告可疑的构造,例如 Printf 调用的实参数与格式化字符串不匹配。
yacc      Yacc 是 yacc 的一个版本,它生成在 Go 中实现的解析器。

This is an abridged list. See the full command reference for documentation of the compilers and more.