Go 1 cheatsheet
Go 1: Quality and release builds
8 common Go 1 tasks.
Read documentation
Show the documentation for a package or symbol in the terminal.
go doc net/http.Client
Cross-compile for Linux
Build for another operating system and architecture.
GOOS=linux GOARCH=amd64 go build -o myapp-linux .
Build a small static binary
Disable cgo and strip debug information for a compact, portable binary.
CGO_ENABLED=0 go build -ldflags="-s -w" -o myapp .
Set a version at build time
Set a string variable in package main from the command line.
go build -ldflags "-X main.version=1.2.3" -o myapp .
Clear the build cache
Delete cached build results, for example to rule out stale artifacts.
go clean -cache