cmd.html 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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 cgo</code>.
  19. For most commands this is mainly useful for debugging.
  20. Some of the commands, such as <code>pprof</code>, are accessible only through
  21. the go <code>tool</code> subcommand.
  22. </p>
  23. <p>
  24. Finally the <code>fmt</code> and <code>godoc</code> commands are installed
  25. as regular binaries called <code>gofmt</code> and <code>godoc</code> because
  26. they are so often referenced.
  27. </p>
  28. <p>
  29. Click on the links for more documentation, invocation methods, and usage details.
  30. </p>
  31. <table class="dir">
  32. <tr>
  33. <th>Name</th>
  34. <th>&nbsp;&nbsp;&nbsp;&nbsp;</th>
  35. <th>Synopsis</th>
  36. </tr>
  37. <tr>
  38. <td><a href="/cmd/go/">go</a></td>
  39. <td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
  40. <td>
  41. The <code>go</code> program manages Go source code and runs the other
  42. commands listed here.
  43. See the command docs for usage
  44. details.
  45. <br><br>
  46. </td>
  47. </tr>
  48. <tr>
  49. <td><a href="/cmd/cgo/">cgo</a></td>
  50. <td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
  51. <td>Cgo enables the creation of Go packages that call C code.</td>
  52. </tr>
  53. <tr>
  54. <td><a href="/cmd/cover/">cover</a></td>
  55. <td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
  56. <td>Cover is a program for creating and analyzing the coverage profiles
  57. generated by <code>"go test -coverprofile"</code>.</td>
  58. </tr>
  59. <tr>
  60. <td><a href="/cmd/fix/">fix</a></td>
  61. <td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
  62. <td>Fix finds Go programs that use old features of the language and libraries
  63. and rewrites them to use newer ones.</td>
  64. </tr>
  65. <tr>
  66. <td><a href="/cmd/gofmt/">fmt</a></td>
  67. <td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
  68. <td>Fmt formats Go packages, it is also available as an independent <a href="/cmd/gofmt/">
  69. gofmt</a> command with more general options.</td>
  70. </tr>
  71. <tr>
  72. <td><a href="//godoc.org/golang.org/x/tools/cmd/godoc/">godoc</a></td>
  73. <td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
  74. <td>Godoc extracts and generates documentation for Go packages.</td>
  75. </tr>
  76. <tr>
  77. <td><a href="/cmd/vet/">vet</a></td>
  78. <td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
  79. <td>Vet examines Go source code and reports suspicious constructs, such as Printf
  80. calls whose arguments do not align with the format string.</td>
  81. </tr>
  82. </table>
  83. <p>
  84. This is an abridged list. See the <a href="/cmd/">full command reference</a>
  85. for documentation of the compilers and more.
  86. </p>