blob: 4d6ac01dc4d83948a0516cced71c8a364103ddde [file] [log] [blame]
Andrew Gerranda22b0f82012-03-05 15:30:27 +11001<!--{
2 "Title": "Command Documentation",
Andrew Gerrand8d5b3242012-03-27 13:46:16 +11003 "Path": "/doc/cmd"
Andrew Gerranda22b0f82012-03-05 15:30:27 +11004}-->
5
6<p>
Rob Pikeb7304642012-03-24 09:29:08 +11007There is a suite of programs to build and process Go source code.
8Instead of being run directly, programs in the suite are usually invoked
9by the <a href="/cmd/go/">go</a> program.
10</p>
11
12<p>
Andrew Gerrand9031f952012-03-27 12:46:46 +110013The most common way to run these programs is as a subcommand of the go program,
14for instance as <code>go fmt</code>. Run like this, the command operates on
15complete packages of Go source code, with the go program invoking the
16underlying binary with arguments appropriate to package-level processing.
Rob Pikeb7304642012-03-24 09:29:08 +110017</p>
18
19<p>
20The programs can also be run as stand-alone binaries, with unmodified arguments,
Andrew Gerrand9031f952012-03-27 12:46:46 +110021using the go <code>tool</code> subcommand, such as <code>go tool vet</code>.
22This style of invocation allows, for instance, checking a single source file
23rather than an entire package: <code>go tool vet myprogram.go</code> as
24compared to <code>go vet mypackage</code>.
Rob Pikeb7304642012-03-24 09:29:08 +110025</p>
26
27<p>
Andrew Gerrand5dd74172013-09-16 15:47:13 +100028Finally the <code>fmt</code> and <code>godoc</code> commands are installed
29as regular binaries called <code>gofmt</code> and <code>godoc</code> because
30they are so often referenced.
Rob Pikeb7304642012-03-24 09:29:08 +110031</p>
32
33<p>
34Click on the links for more documentation, invocation methods, and usage details.
Andrew Gerranda22b0f82012-03-05 15:30:27 +110035</p>
36
37<table class="dir">
38<tr>
39<th>Name</th>
40<th>&nbsp;&nbsp;&nbsp;&nbsp;</th>
41<th>Synopsis</th>
42</tr>
43
44<tr>
45<td><a href="/cmd/go/">go</a></td>
46<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
47<td>
Rob Pikeb7304642012-03-24 09:29:08 +110048The <code>go</code> program manages Go source code and runs the other
49commands listed here.
50See the command docs for usage
Andrew Gerranda22b0f82012-03-05 15:30:27 +110051details.
52<br><br>
53</td>
54</tr>
55
56<tr>
57<td><a href="/cmd/cgo/">cgo</a></td>
58<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
59<td>Cgo enables the creation of Go packages that call C code.</td>
60</tr>
61
62<tr>
Andrew Gerrand7f0be1f2014-11-10 09:15:57 +110063<td><a href="//godoc.org/golang.org/x/tools/cmd/cover/">cover</a></td>
Andrew Gerrand5dd74172013-09-16 15:47:13 +100064<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
65<td>Cover is a program for creating and analyzing the coverage profiles
Oling Cat2511d922014-08-26 05:26:48 -070066generated by <code>"go test -coverprofile"</code>.</td>
Andrew Gerrand5dd74172013-09-16 15:47:13 +100067</tr>
68
69<tr>
Andrew Gerranda22b0f82012-03-05 15:30:27 +110070<td><a href="/cmd/fix/">fix</a></td>
71<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
72<td>Fix finds Go programs that use old features of the language and libraries
73and rewrites them to use newer ones.</td>
74</tr>
75
76<tr>
Shenghou Ma54a2e632012-03-23 23:21:52 +080077<td><a href="/cmd/go/">fmt</a></td>
Andrew Gerranda22b0f82012-03-05 15:30:27 +110078<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
Shenghou Ma54a2e632012-03-23 23:21:52 +080079<td>Fmt formats Go packages, it is also available as an independent <a href="/cmd/gofmt/">
80gofmt</a> command with more general options.</td>
Andrew Gerranda22b0f82012-03-05 15:30:27 +110081</tr>
82
83<tr>
Andrew Gerrand7f0be1f2014-11-10 09:15:57 +110084<td><a href="//godoc.org/golang.org/x/tools/cmd/godoc/">godoc</a></td>
Andrew Gerrand5dd74172013-09-16 15:47:13 +100085<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
86<td>Godoc extracts and generates documentation for Go packages.</td>
87</tr>
88
89<tr>
Scott Bell1b868622016-05-16 13:13:25 -070090<td><a href="/cmd/vet/">vet</a></td>
Andrew Gerranda22b0f82012-03-05 15:30:27 +110091<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
Shenghou Ma54a2e632012-03-23 23:21:52 +080092<td>Vet examines Go source code and reports suspicious constructs, such as Printf
93calls whose arguments do not align with the format string.</td>
Andrew Gerranda22b0f82012-03-05 15:30:27 +110094</tr>
95
Andrew Gerranda22b0f82012-03-05 15:30:27 +110096</table>
97
98<p>
99This is an abridged list. See the <a href="/cmd/">full command reference</a>
100for documentation of the compilers and more.
101</p>