Andrew Gerrand | a22b0f8 | 2012-03-05 15:30:27 +1100 | [diff] [blame] | 1 | <!--{ |
| 2 | "Title": "Command Documentation", |
Andrew Gerrand | 8d5b324 | 2012-03-27 13:46:16 +1100 | [diff] [blame] | 3 | "Path": "/doc/cmd" |
Andrew Gerrand | a22b0f8 | 2012-03-05 15:30:27 +1100 | [diff] [blame] | 4 | }--> |
| 5 | |
| 6 | <p> |
Rob Pike | b730464 | 2012-03-24 09:29:08 +1100 | [diff] [blame] | 7 | There is a suite of programs to build and process Go source code. |
| 8 | Instead of being run directly, programs in the suite are usually invoked |
| 9 | by the <a href="/cmd/go/">go</a> program. |
| 10 | </p> |
| 11 | |
| 12 | <p> |
Andrew Gerrand | 9031f95 | 2012-03-27 12:46:46 +1100 | [diff] [blame] | 13 | The most common way to run these programs is as a subcommand of the go program, |
| 14 | for instance as <code>go fmt</code>. Run like this, the command operates on |
| 15 | complete packages of Go source code, with the go program invoking the |
| 16 | underlying binary with arguments appropriate to package-level processing. |
Rob Pike | b730464 | 2012-03-24 09:29:08 +1100 | [diff] [blame] | 17 | </p> |
| 18 | |
| 19 | <p> |
| 20 | The programs can also be run as stand-alone binaries, with unmodified arguments, |
Andrew Gerrand | 9031f95 | 2012-03-27 12:46:46 +1100 | [diff] [blame] | 21 | using the go <code>tool</code> subcommand, such as <code>go tool vet</code>. |
| 22 | This style of invocation allows, for instance, checking a single source file |
| 23 | rather than an entire package: <code>go tool vet myprogram.go</code> as |
| 24 | compared to <code>go vet mypackage</code>. |
Rob Pike | b730464 | 2012-03-24 09:29:08 +1100 | [diff] [blame] | 25 | </p> |
| 26 | |
| 27 | <p> |
Andrew Gerrand | 5dd7417 | 2013-09-16 15:47:13 +1000 | [diff] [blame] | 28 | Finally the <code>fmt</code> and <code>godoc</code> commands are installed |
| 29 | as regular binaries called <code>gofmt</code> and <code>godoc</code> because |
| 30 | they are so often referenced. |
Rob Pike | b730464 | 2012-03-24 09:29:08 +1100 | [diff] [blame] | 31 | </p> |
| 32 | |
| 33 | <p> |
| 34 | Click on the links for more documentation, invocation methods, and usage details. |
Andrew Gerrand | a22b0f8 | 2012-03-05 15:30:27 +1100 | [diff] [blame] | 35 | </p> |
| 36 | |
| 37 | <table class="dir"> |
| 38 | <tr> |
| 39 | <th>Name</th> |
| 40 | <th> </th> |
| 41 | <th>Synopsis</th> |
| 42 | </tr> |
| 43 | |
| 44 | <tr> |
| 45 | <td><a href="/cmd/go/">go</a></td> |
| 46 | <td> </td> |
| 47 | <td> |
Rob Pike | b730464 | 2012-03-24 09:29:08 +1100 | [diff] [blame] | 48 | The <code>go</code> program manages Go source code and runs the other |
| 49 | commands listed here. |
| 50 | See the command docs for usage |
Andrew Gerrand | a22b0f8 | 2012-03-05 15:30:27 +1100 | [diff] [blame] | 51 | details. |
| 52 | <br><br> |
| 53 | </td> |
| 54 | </tr> |
| 55 | |
| 56 | <tr> |
| 57 | <td><a href="/cmd/cgo/">cgo</a></td> |
| 58 | <td> </td> |
| 59 | <td>Cgo enables the creation of Go packages that call C code.</td> |
| 60 | </tr> |
| 61 | |
| 62 | <tr> |
Andrew Gerrand | 7f0be1f | 2014-11-10 09:15:57 +1100 | [diff] [blame] | 63 | <td><a href="//godoc.org/golang.org/x/tools/cmd/cover/">cover</a></td> |
Andrew Gerrand | 5dd7417 | 2013-09-16 15:47:13 +1000 | [diff] [blame] | 64 | <td> </td> |
| 65 | <td>Cover is a program for creating and analyzing the coverage profiles |
Oling Cat | 2511d92 | 2014-08-26 05:26:48 -0700 | [diff] [blame] | 66 | generated by <code>"go test -coverprofile"</code>.</td> |
Andrew Gerrand | 5dd7417 | 2013-09-16 15:47:13 +1000 | [diff] [blame] | 67 | </tr> |
| 68 | |
| 69 | <tr> |
Andrew Gerrand | a22b0f8 | 2012-03-05 15:30:27 +1100 | [diff] [blame] | 70 | <td><a href="/cmd/fix/">fix</a></td> |
| 71 | <td> </td> |
| 72 | <td>Fix finds Go programs that use old features of the language and libraries |
| 73 | and rewrites them to use newer ones.</td> |
| 74 | </tr> |
| 75 | |
| 76 | <tr> |
Shenghou Ma | 54a2e63 | 2012-03-23 23:21:52 +0800 | [diff] [blame] | 77 | <td><a href="/cmd/go/">fmt</a></td> |
Andrew Gerrand | a22b0f8 | 2012-03-05 15:30:27 +1100 | [diff] [blame] | 78 | <td> </td> |
Shenghou Ma | 54a2e63 | 2012-03-23 23:21:52 +0800 | [diff] [blame] | 79 | <td>Fmt formats Go packages, it is also available as an independent <a href="/cmd/gofmt/"> |
| 80 | gofmt</a> command with more general options.</td> |
Andrew Gerrand | a22b0f8 | 2012-03-05 15:30:27 +1100 | [diff] [blame] | 81 | </tr> |
| 82 | |
| 83 | <tr> |
Andrew Gerrand | 7f0be1f | 2014-11-10 09:15:57 +1100 | [diff] [blame] | 84 | <td><a href="//godoc.org/golang.org/x/tools/cmd/godoc/">godoc</a></td> |
Andrew Gerrand | 5dd7417 | 2013-09-16 15:47:13 +1000 | [diff] [blame] | 85 | <td> </td> |
| 86 | <td>Godoc extracts and generates documentation for Go packages.</td> |
| 87 | </tr> |
| 88 | |
| 89 | <tr> |
Scott Bell | 1b86862 | 2016-05-16 13:13:25 -0700 | [diff] [blame] | 90 | <td><a href="/cmd/vet/">vet</a></td> |
Andrew Gerrand | a22b0f8 | 2012-03-05 15:30:27 +1100 | [diff] [blame] | 91 | <td> </td> |
Shenghou Ma | 54a2e63 | 2012-03-23 23:21:52 +0800 | [diff] [blame] | 92 | <td>Vet examines Go source code and reports suspicious constructs, such as Printf |
| 93 | calls whose arguments do not align with the format string.</td> |
Andrew Gerrand | a22b0f8 | 2012-03-05 15:30:27 +1100 | [diff] [blame] | 94 | </tr> |
| 95 | |
Andrew Gerrand | a22b0f8 | 2012-03-05 15:30:27 +1100 | [diff] [blame] | 96 | </table> |
| 97 | |
| 98 | <p> |
| 99 | This is an abridged list. See the <a href="/cmd/">full command reference</a> |
| 100 | for documentation of the compilers and more. |
| 101 | </p> |