1
0
mirror of https://github.com/golang/go synced 2024-10-03 09:21:21 -06:00
go/doc/reference-cmd.html
Rob Pike 7b8f8bf5b5 doc/reference-cmd: use vet as example, not fmt
"go tool fmt" doesn't work, "go tool vet" does.

R=golang-dev, rogpeppe, r, minux.ma, bradfitz
CC=golang-dev
https://golang.org/cl/5900049
2012-03-25 11:35:16 +11:00

118 lines
3.1 KiB
HTML

<!--{
"Title": "Command Documentation",
"Path": "/ref/cmd"
}-->
<p>
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 <a href="/cmd/go/">go</a> program.
</p>
<p>
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.
</p>
<p>
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 prof and yacc, are accessible
only through the go tool subcommand.
</p>
<p>
Finally, two of the commands, fmt and
doc, are also installed as regular binaries called
gofmt and godoc
because they are so often referenced.
</p>
<p>
Click on the links for more documentation, invocation methods, and usage details.
</p>
<table class="dir">
<tr>
<th>Name</th>
<th>&nbsp;&nbsp;&nbsp;&nbsp;</th>
<th>Synopsis</th>
</tr>
<tr>
<td><a href="/cmd/go/">go</a></td>
<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
<td>
The <code>go</code> program manages Go source code and runs the other
commands listed here.
See the command docs for usage
details.
<br><br>
</td>
</tr>
<tr>
<td><a href="/cmd/cgo/">cgo</a></td>
<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
<td>Cgo enables the creation of Go packages that call C code.</td>
</tr>
<tr>
<td><a href="/cmd/cov/">cov</a></td>
<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
<td>Cov is a rudimentary code coverage tool.</td>
</tr>
<tr>
<td><a href="/cmd/fix/">fix</a></td>
<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
<td>Fix finds Go programs that use old features of the language and libraries
and rewrites them to use newer ones.</td>
</tr>
<tr>
<td><a href="/cmd/go/">doc</a></td>
<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
<td>Doc extracts and generates documentation for Go packages, it is also available as
an independent <a href="/cmd/godoc/">godoc</a> command with more general options.</td>
</tr>
<tr>
<td><a href="/cmd/go/">fmt</a></td>
<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
<td>Fmt formats Go packages, it is also available as an independent <a href="/cmd/gofmt/">
gofmt</a> command with more general options.</td>
</tr>
<tr>
<td><a href="/cmd/prof/">prof</a></td>
<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
<td>Prof is a rudimentary real-time profiler.</td>
</tr>
<tr>
<td><a href="/cmd/vet/">vet</a></td>
<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
<td>Vet examines Go source code and reports suspicious constructs, such as Printf
calls whose arguments do not align with the format string.</td>
</tr>
<tr>
<td><a href="/cmd/yacc/">yacc</a></td>
<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
<td>Yacc is a version of yacc that generates parsers implemented in Go.</td>
</tr>
</table>
<p>
This is an abridged list. See the <a href="/cmd/">full command reference</a>
for documentation of the compilers and more.
</p>