github.com/yukk001/go1.10.8@v0.0.0-20190813125351-6df2d3982e20/doc/cmd.html (about) 1 <!--{ 2 "Title": "Command Documentation", 3 "Path": "/doc/cmd" 4 }--> 5 6 <p> 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> 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. 17 </p> 18 19 <p> 20 The programs can also be run as stand-alone binaries, with unmodified arguments, 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>pprof</code>, are accessible only through 26 the go <code>tool</code> subcommand. 27 </p> 28 29 <p> 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. 33 </p> 34 35 <p> 36 Click on the links for more documentation, invocation methods, and usage details. 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> 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 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> 65 <td><a href="/cmd/cover/">cover</a></td> 66 <td> </td> 67 <td>Cover is a program for creating and analyzing the coverage profiles 68 generated by <code>"go test -coverprofile"</code>.</td> 69 </tr> 70 71 <tr> 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> 79 <td><a href="/cmd/go/">fmt</a></td> 80 <td> </td> 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> 83 </tr> 84 85 <tr> 86 <td><a href="//godoc.org/golang.org/x/tools/cmd/godoc/">godoc</a></td> 87 <td> </td> 88 <td>Godoc extracts and generates documentation for Go packages.</td> 89 </tr> 90 91 <tr> 92 <td><a href="/cmd/vet/">vet</a></td> 93 <td> </td> 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> 96 </tr> 97 98 </table> 99 100 <p> 101 This is an abridged list. See the <a href="/cmd/">full command reference</a> 102 for documentation of the compilers and more. 103 </p>