1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-04-22 10:02:10 +02:00
tldr/pages/common/go.md
Lena b596b78b18
pages/*: standardize mentioning subcommands without the main command (#13626)
* pages/*: standardize mentioning subcommands without the main command

* CONTRIBUTING: clarify that pages should only mention the subcommand
2024-10-04 21:14:41 +02:00

729 B

go

Manage Go source code. Some subcommands such as build have their own usage documentation. More information: https://golang.org.

  • Download and install a package, specified by its import path:

go get {{package_path}}

  • Compile and run a source file (it has to contain a main package):

go run {{file}}.go

  • Compile a source file into a named executable:

go build -o {{executable}} {{file}}.go

  • Compile the package present in the current directory:

go build

  • Execute all test cases of the current package (files have to end with _test.go):

go test

  • Compile and install the current package:

go install

  • Initialize a new module in the current directory:

go mod init {{module_name}}