| 
									
										
										
										
											2012-03-05 15:30:27 +11:00
										 |  |  | <!--{
 | 
					
						
							|  |  |  | 	"Title": "Command Documentation", | 
					
						
							| 
									
										
										
										
											2012-03-27 13:46:16 +11:00
										 |  |  | 	"Path":  "/doc/cmd" | 
					
						
							| 
									
										
										
										
											2012-03-05 15:30:27 +11:00
										 |  |  | }--> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <p> | 
					
						
							| 
									
										
										
										
											2012-03-24 09:29:08 +11:00
										 |  |  | There is a suite of programs to build and process Go source code. | 
					
						
							|  |  |  | Instead of being run directly, programs in the suite are usually invoked | 
					
						
							|  |  |  | by the <a href="/cmd/go/">go</a> program. | 
					
						
							|  |  |  | </p> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <p> | 
					
						
							| 
									
										
										
										
											2012-03-27 12:46:46 +11:00
										 |  |  | The most common way to run these programs is as a subcommand of the go program, | 
					
						
							|  |  |  | for instance as <code>go fmt</code>. Run like this, the command operates on | 
					
						
							|  |  |  | complete packages of Go source code, with the go program invoking the | 
					
						
							|  |  |  | underlying binary with arguments appropriate to package-level processing. | 
					
						
							| 
									
										
										
										
											2012-03-24 09:29:08 +11:00
										 |  |  | </p> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <p> | 
					
						
							|  |  |  | The programs can also be run as stand-alone binaries, with unmodified arguments, | 
					
						
							| 
									
										
										
										
											2012-03-27 12:46:46 +11:00
										 |  |  | using the go <code>tool</code> subcommand, such as <code>go tool vet</code>. | 
					
						
							|  |  |  | This style of invocation allows, for instance, checking a single source file | 
					
						
							|  |  |  | rather than an entire package: <code>go tool vet myprogram.go</code> as | 
					
						
							|  |  |  | compared to <code>go vet mypackage</code>. | 
					
						
							| 
									
										
										
										
											2017-05-22 14:00:09 +02:00
										 |  |  | Some of the commands, such as <code>pprof</code>, are accessible only through | 
					
						
							|  |  |  | the go <code>tool</code> subcommand. | 
					
						
							| 
									
										
										
										
											2012-03-24 09:29:08 +11:00
										 |  |  | </p> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <p> | 
					
						
							| 
									
										
										
										
											2013-09-16 15:47:13 +10:00
										 |  |  | Finally the <code>fmt</code> and <code>godoc</code> commands are installed | 
					
						
							|  |  |  | as regular binaries called <code>gofmt</code> and <code>godoc</code> because | 
					
						
							|  |  |  | they are so often referenced. | 
					
						
							| 
									
										
										
										
											2012-03-24 09:29:08 +11:00
										 |  |  | </p> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <p> | 
					
						
							|  |  |  | Click on the links for more documentation, invocation methods, and usage details. | 
					
						
							| 
									
										
										
										
											2012-03-05 15:30:27 +11:00
										 |  |  | </p> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <table class="dir"> | 
					
						
							|  |  |  | <tr> | 
					
						
							|  |  |  | <th>Name</th> | 
					
						
							|  |  |  | <th>    </th> | 
					
						
							|  |  |  | <th>Synopsis</th> | 
					
						
							|  |  |  | </tr> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <tr> | 
					
						
							|  |  |  | <td><a href="/cmd/go/">go</a></td> | 
					
						
							|  |  |  | <td>    </td> | 
					
						
							|  |  |  | <td> | 
					
						
							| 
									
										
										
										
											2012-03-24 09:29:08 +11:00
										 |  |  | The <code>go</code> program manages Go source code and runs the other | 
					
						
							|  |  |  | commands listed here. | 
					
						
							|  |  |  | See the command docs for usage | 
					
						
							| 
									
										
										
										
											2012-03-05 15:30:27 +11:00
										 |  |  | details. | 
					
						
							|  |  |  | <br><br> | 
					
						
							|  |  |  | </td> | 
					
						
							|  |  |  | </tr> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <tr> | 
					
						
							|  |  |  | <td><a href="/cmd/cgo/">cgo</a></td> | 
					
						
							|  |  |  | <td>    </td> | 
					
						
							|  |  |  | <td>Cgo enables the creation of Go packages that call C code.</td> | 
					
						
							|  |  |  | </tr> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <tr> | 
					
						
							| 
									
										
										
										
											2017-06-18 15:11:49 +03:00
										 |  |  | <td><a href="/cmd/cover/">cover</a></td> | 
					
						
							| 
									
										
										
										
											2012-03-05 15:30:27 +11:00
										 |  |  | <td>    </td> | 
					
						
							| 
									
										
										
										
											2013-09-16 15:47:13 +10:00
										 |  |  | <td>Cover is a program for creating and analyzing the coverage profiles | 
					
						
							| 
									
										
										
										
											2014-08-26 05:26:48 -07:00
										 |  |  | generated by <code>"go test -coverprofile"</code>.</td> | 
					
						
							| 
									
										
										
										
											2012-03-05 15:30:27 +11:00
										 |  |  | </tr> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <tr> | 
					
						
							| 
									
										
										
										
											2013-09-16 15:47:13 +10:00
										 |  |  | <td><a href="/cmd/fix/">fix</a></td> | 
					
						
							| 
									
										
										
										
											2012-03-05 15:30:27 +11:00
										 |  |  | <td>    </td> | 
					
						
							| 
									
										
										
										
											2013-09-16 15:47:13 +10:00
										 |  |  | <td>Fix finds Go programs that use old features of the language and libraries | 
					
						
							|  |  |  | and rewrites them to use newer ones.</td> | 
					
						
							| 
									
										
										
										
											2012-03-05 15:30:27 +11:00
										 |  |  | </tr> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <tr> | 
					
						
							| 
									
										
										
										
											2012-03-23 23:21:52 +08:00
										 |  |  | <td><a href="/cmd/go/">fmt</a></td> | 
					
						
							| 
									
										
										
										
											2012-03-05 15:30:27 +11:00
										 |  |  | <td>    </td> | 
					
						
							| 
									
										
										
										
											2012-03-23 23:21:52 +08:00
										 |  |  | <td>Fmt formats Go packages, it is also available as an independent <a href="/cmd/gofmt/"> | 
					
						
							|  |  |  | gofmt</a> command with more general options.</td> | 
					
						
							| 
									
										
										
										
											2012-03-05 15:30:27 +11:00
										 |  |  | </tr> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <tr> | 
					
						
							| 
									
										
										
										
											2014-11-10 09:15:57 +11:00
										 |  |  | <td><a href="//godoc.org/golang.org/x/tools/cmd/godoc/">godoc</a></td> | 
					
						
							| 
									
										
										
										
											2013-09-16 15:47:13 +10:00
										 |  |  | <td>    </td> | 
					
						
							|  |  |  | <td>Godoc extracts and generates documentation for Go packages.</td> | 
					
						
							|  |  |  | </tr> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <tr> | 
					
						
							| 
									
										
										
										
											2016-05-16 13:13:25 -07:00
										 |  |  | <td><a href="/cmd/vet/">vet</a></td> | 
					
						
							| 
									
										
										
										
											2012-03-05 15:30:27 +11:00
										 |  |  | <td>    </td> | 
					
						
							| 
									
										
										
										
											2012-03-23 23:21:52 +08:00
										 |  |  | <td>Vet examines Go source code and reports suspicious constructs, such as Printf | 
					
						
							|  |  |  | calls whose arguments do not align with the format string.</td> | 
					
						
							| 
									
										
										
										
											2012-03-05 15:30:27 +11:00
										 |  |  | </tr> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | </table> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <p> | 
					
						
							|  |  |  | This is an abridged list. See the <a href="/cmd/">full command reference</a> | 
					
						
							|  |  |  | for documentation of the compilers and more. | 
					
						
							|  |  |  | </p> |