1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-04-29 00:24:56 +02:00
tldr/pages/common/go-build.md
gonejack ae117a5437
go-build: apply suggestions
Signed-off-by: gonejack <igonejack@gmail.com>
2020-05-21 12:30:23 +01:00

436 B

go build

Compile Go sources. More information: https://golang.org/cmd/go/#hdr-Compile_packages_and_dependencies.

  • Compile a file:

go build path/to/main.go

  • Compile into named output:

go build -o {{binary}} path/to/source.go

  • Compile a package:

go build -o {{binary}} path/to/package

  • Compile a main package into an executable, with data race detection:

go build -race -o {{executable}} path/to/main/package