blob: 5d20d3887ae96cbb841cfb1e50fd0dce77d5ff3c [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>.
25Some of the commands, such as <code>yacc</code>, are accessible only through
26the go <code>tool</code> subcommand.
Rob Pikeb7304642012-03-24 09:29:08 +110027</p>
28
29<p>
Andrew Gerrand5dd74172013-09-16 15:47:13 +100030Finally the <code>fmt</code> and <code>godoc</code> commands are installed
31as regular binaries called <code>gofmt</code> and <code>godoc</code> because
32they are so often referenced.
Rob Pikeb7304642012-03-24 09:29:08 +110033</p>
34
35<p>
36Click on the links for more documentation, invocation methods, and usage details.
Andrew Gerranda22b0f82012-03-05 15:30:27 +110037</p>
38
39<table class="dir">
40<tr>
41<th>Name</th>
42<th>&nbsp;&nbsp;&nbsp;&nbsp;</th>
43<th>Synopsis</th>
44</tr>
45
46<tr>
47<td><a href="/cmd/go/">go</a></td>
48<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
49<td>
Rob Pikeb7304642012-03-24 09:29:08 +110050The <code>go</code> program manages Go source code and runs the other
51commands listed here.
52See the command docs for usage
Andrew Gerranda22b0f82012-03-05 15:30:27 +110053details.
54<br><br>
55</td>
56</tr>
57
58<tr>
59<td><a href="/cmd/cgo/">cgo</a></td>
60<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
61<td>Cgo enables the creation of Go packages that call C code.</td>
62</tr>
63
64<tr>
Andrew Gerrand7f0be1f2014-11-10 09:15:57 +110065<td><a href="//godoc.org/golang.org/x/tools/cmd/cover/">cover</a></td>
Andrew Gerrand5dd74172013-09-16 15:47:13 +100066<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
67<td>Cover is a program for creating and analyzing the coverage profiles
Oling Cat2511d922014-08-26 05:26:48 -070068generated by <code>"go test -coverprofile"</code>.</td>
Andrew Gerrand5dd74172013-09-16 15:47:13 +100069</tr>
70
71<tr>
Andrew Gerranda22b0f82012-03-05 15:30:27 +110072<td><a href="/cmd/fix/">fix</a></td>
73<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
74<td>Fix finds Go programs that use old features of the language and libraries
75and rewrites them to use newer ones.</td>
76</tr>
77
78<tr>
Shenghou Ma54a2e632012-03-23 23:21:52 +080079<td><a href="/cmd/go/">fmt</a></td>
Andrew Gerranda22b0f82012-03-05 15:30:27 +110080<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
Shenghou Ma54a2e632012-03-23 23:21:52 +080081<td>Fmt formats Go packages, it is also available as an independent <a href="/cmd/gofmt/">
82gofmt</a> command with more general options.</td>
Andrew Gerranda22b0f82012-03-05 15:30:27 +110083</tr>
84
85<tr>
Andrew Gerrand7f0be1f2014-11-10 09:15:57 +110086<td><a href="//godoc.org/golang.org/x/tools/cmd/godoc/">godoc</a></td>
Andrew Gerrand5dd74172013-09-16 15:47:13 +100087<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
88<td>Godoc extracts and generates documentation for Go packages.</td>
89</tr>
90
91<tr>
Andrew Gerrand7f0be1f2014-11-10 09:15:57 +110092<td><a href="//godoc.org/golang.org/x/tools/cmd/vet/">vet</a></td>
Andrew Gerranda22b0f82012-03-05 15:30:27 +110093<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
Shenghou Ma54a2e632012-03-23 23:21:52 +080094<td>Vet examines Go source code and reports suspicious constructs, such as Printf
95calls whose arguments do not align with the format string.</td>
Andrew Gerranda22b0f82012-03-05 15:30:27 +110096</tr>
97
98<tr>
99<td><a href="/cmd/yacc/">yacc</a></td>
100<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
Rob Pikeb7304642012-03-24 09:29:08 +1100101<td>Yacc is a version of yacc that generates parsers implemented in Go.</td>
Andrew Gerranda22b0f82012-03-05 15:30:27 +1100102</tr>
103
104</table>
105
106<p>
107This is an abridged list. See the <a href="/cmd/">full command reference</a>
108for documentation of the compilers and more.
109</p>