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>. |
| 25 | Some of the commands, such as <code>yacc</code>, are accessible only through |
| 26 | the go <code>tool</code> subcommand. |
Rob Pike | b730464 | 2012-03-24 09:29:08 +1100 | [diff] [blame] | 27 | </p> |
| 28 | |
| 29 | <p> |
Andrew Gerrand | 5dd7417 | 2013-09-16 15:47:13 +1000 | [diff] [blame] | 30 | Finally the <code>fmt</code> and <code>godoc</code> commands are installed |
| 31 | as regular binaries called <code>gofmt</code> and <code>godoc</code> because |
| 32 | they are so often referenced. |
Rob Pike | b730464 | 2012-03-24 09:29:08 +1100 | [diff] [blame] | 33 | </p> |
| 34 | |
| 35 | <p> |
| 36 | Click on the links for more documentation, invocation methods, and usage details. |
Andrew Gerrand | a22b0f8 | 2012-03-05 15:30:27 +1100 | [diff] [blame] | 37 | </p> |
| 38 | |
| 39 | <table class="dir"> |
| 40 | <tr> |
| 41 | <th>Name</th> |
| 42 | <th> </th> |
| 43 | <th>Synopsis</th> |
| 44 | </tr> |
| 45 | |
| 46 | <tr> |
| 47 | <td><a href="/cmd/go/">go</a></td> |
| 48 | <td> </td> |
| 49 | <td> |
Rob Pike | b730464 | 2012-03-24 09:29:08 +1100 | [diff] [blame] | 50 | The <code>go</code> program manages Go source code and runs the other |
| 51 | commands listed here. |
| 52 | See the command docs for usage |
Andrew Gerrand | a22b0f8 | 2012-03-05 15:30:27 +1100 | [diff] [blame] | 53 | details. |
| 54 | <br><br> |
| 55 | </td> |
| 56 | </tr> |
| 57 | |
| 58 | <tr> |
| 59 | <td><a href="/cmd/cgo/">cgo</a></td> |
| 60 | <td> </td> |
| 61 | <td>Cgo enables the creation of Go packages that call C code.</td> |
| 62 | </tr> |
| 63 | |
| 64 | <tr> |
Andrew Gerrand | 7f0be1f | 2014-11-10 09:15:57 +1100 | [diff] [blame] | 65 | <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] | 66 | <td> </td> |
| 67 | <td>Cover is a program for creating and analyzing the coverage profiles |
Oling Cat | 2511d92 | 2014-08-26 05:26:48 -0700 | [diff] [blame] | 68 | generated by <code>"go test -coverprofile"</code>.</td> |
Andrew Gerrand | 5dd7417 | 2013-09-16 15:47:13 +1000 | [diff] [blame] | 69 | </tr> |
| 70 | |
| 71 | <tr> |
Andrew Gerrand | a22b0f8 | 2012-03-05 15:30:27 +1100 | [diff] [blame] | 72 | <td><a href="/cmd/fix/">fix</a></td> |
| 73 | <td> </td> |
| 74 | <td>Fix finds Go programs that use old features of the language and libraries |
| 75 | and rewrites them to use newer ones.</td> |
| 76 | </tr> |
| 77 | |
| 78 | <tr> |
Shenghou Ma | 54a2e63 | 2012-03-23 23:21:52 +0800 | [diff] [blame] | 79 | <td><a href="/cmd/go/">fmt</a></td> |
Andrew Gerrand | a22b0f8 | 2012-03-05 15:30:27 +1100 | [diff] [blame] | 80 | <td> </td> |
Shenghou Ma | 54a2e63 | 2012-03-23 23:21:52 +0800 | [diff] [blame] | 81 | <td>Fmt formats Go packages, it is also available as an independent <a href="/cmd/gofmt/"> |
| 82 | gofmt</a> command with more general options.</td> |
Andrew Gerrand | a22b0f8 | 2012-03-05 15:30:27 +1100 | [diff] [blame] | 83 | </tr> |
| 84 | |
| 85 | <tr> |
Andrew Gerrand | 7f0be1f | 2014-11-10 09:15:57 +1100 | [diff] [blame] | 86 | <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] | 87 | <td> </td> |
| 88 | <td>Godoc extracts and generates documentation for Go packages.</td> |
| 89 | </tr> |
| 90 | |
| 91 | <tr> |
Andrew Gerrand | 7f0be1f | 2014-11-10 09:15:57 +1100 | [diff] [blame] | 92 | <td><a href="//godoc.org/golang.org/x/tools/cmd/vet/">vet</a></td> |
Andrew Gerrand | a22b0f8 | 2012-03-05 15:30:27 +1100 | [diff] [blame] | 93 | <td> </td> |
Shenghou Ma | 54a2e63 | 2012-03-23 23:21:52 +0800 | [diff] [blame] | 94 | <td>Vet examines Go source code and reports suspicious constructs, such as Printf |
| 95 | calls whose arguments do not align with the format string.</td> |
Andrew Gerrand | a22b0f8 | 2012-03-05 15:30:27 +1100 | [diff] [blame] | 96 | </tr> |
| 97 | |
| 98 | <tr> |
| 99 | <td><a href="/cmd/yacc/">yacc</a></td> |
| 100 | <td> </td> |
Rob Pike | b730464 | 2012-03-24 09:29:08 +1100 | [diff] [blame] | 101 | <td>Yacc is a version of yacc that generates parsers implemented in Go.</td> |
Andrew Gerrand | a22b0f8 | 2012-03-05 15:30:27 +1100 | [diff] [blame] | 102 | </tr> |
| 103 | |
| 104 | </table> |
| 105 | |
| 106 | <p> |
| 107 | This is an abridged list. See the <a href="/cmd/">full command reference</a> |
| 108 | for documentation of the compilers and more. |
| 109 | </p> |