cmd.html 2.9 KB

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