Go Developer
Toolkit

go tool -n

Standard toolchain first. Third-party where it genuinely adds value. Filterable by phase.

18 tools
7 phases
Go 1.22+, stdlib-first
std Go toolchain / golang.org/x , no badge = third-party
Phase 18 tools shown
ToolPhaseKey commandsUse case
go buildstd build
go build -v ./... go build -ldflags="-s -w -X main.version=$(git describe --tags)" -o bin/app ./cmd/app CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o bin/app-linux ./cmd/app go build -race ./... go build -gcflags="all=-N -l" -o bin/app ./cmd/app # -gcflags disables optimisations for dlv debugging
-ldflags="-s -w" strips debug info and symbol table: mandatory for production binaries. -X injects build-time variables. CGO_ENABLED=0 produces a fully static binary safe for scratch/distroless images.
go envstd build
go env go env GOPATH GOMODCACHE GOPROXY go env -w GOPROXY=https://proxy.golang.org,direct go env -w GONOSUMCHECK=*.internal.example.com go env -w GOFLAGS=-mod=vendor
Inspect and persistently set Go environment variables. -w writes to $GOENV (user-level), avoiding shell profile pollution. Use GONOSUMCHECK for private modules that bypass the checksum DB.
go generatestd build
go generate ./... go generate -v -run stringer ./... go generate -x ./pkg/... # common directives in source: //go:generate stringer -type=Status //go:generate mockgen -source=iface.go -destination=mock_iface.go
Run code generation directives embedded in source: stringer, mockgen, protoc, sqlc. -run filters to a specific generator. Always commit generated files; never generate in CI without committing.
air build
air init air air -c .air.toml # .air.toml key fields: # cmd = "go build -o ./tmp/main ./cmd/app" # include_ext = ["go", "tmpl", "yaml"]
Live-reload for Go: watches source files, rebuilds, and restarts on change. Configurable via .air.toml. Scope include_ext tightly; watching ./... indiscriminately causes rebuild storms.
go teststd test
go test -race -count=1 -timeout=60s ./... go test -run TestMyFunc -v ./pkg/mypackage/ go test -bench=. -benchmem -benchtime=5s ./... go test -fuzz=FuzzParseInput -fuzztime=30s ./pkg/parser/ go test -tags integration ./... go test -coverprofile=coverage.out -coverpkg=./... ./...
-count=1 disables the test cache. Always use in CI. -race is non-negotiable in CI; it has near-zero false-positive rate. -coverpkg=./... measures coverage across all packages, not just the tested package.
go tool coverstd test
go test -coverprofile=coverage.out ./... go tool cover -func=coverage.out | tail -1 go tool cover -func=coverage.out | grep -v "100.0%" go tool cover -html=coverage.out -o coverage.html go tool cover -func=coverage.out | awk '$3 < 80.0 {print}'
Coverage analysis without third-party tools. -func gives per-function percentages; pipe through awk to surface under-covered packages. -html produces an annotated source browser.
benchstatstd test
go install golang.org/x/perf/cmd/benchstat@latest go test -bench=. -count=10 ./... > old.txt # make your change, then: go test -bench=. -count=10 ./... > new.txt benchstat old.txt new.txt benchstat -filter .name=/BenchmarkParse old.txt new.txt
Statistical comparison of benchmark runs: reports mean, variance, and whether the delta is significant. -count=10 minimum for reliable results; benchstat rejects noise. From golang.org/x/perf: Go team maintained.
go tool pprofstd profile
go test -cpuprofile=cpu.prof -memprofile=mem.prof -bench=. ./... go tool pprof -http=:8080 cpu.prof go tool pprof http://localhost:6060/debug/pprof/heap go tool pprof http://localhost:6060/debug/pprof/goroutine go tool pprof http://localhost:6060/debug/pprof/mutex # in interactive mode: top10, list <func>, web, peek <func>
CPU, heap, goroutine, block, and mutex profiling. Expose /debug/pprof with import _ "net/http/pprof". -http=:8080 opens an interactive flame graph browser. Always start here before reading raw output.
go tool tracestd profile
go test -trace=trace.out ./pkg/mypackage/ go tool trace trace.out curl -s http://localhost:6060/debug/pprof/trace?seconds=5 > trace.out go tool trace trace.out # in source, for fine-grained spans: // import "runtime/trace" // trace.Start(f); defer trace.Stop()
Execution tracer: shows goroutine scheduling, GC pauses, syscalls, and network I/O on a timeline. Distinct from pprof: pprof shows where time is spent; trace shows why goroutines are blocked.
go tool asm / compilestd profile
go build -gcflags="-m" ./pkg/hot/ go build -gcflags="-m=2" ./pkg/hot/ go tool compile -S myfile.go 2>&1 | grep -A5 "myFunc" GOARCH=amd64 go tool objdump -s "main\.main" bin/app go tool nm bin/app | sort -k1 -rn | head -20
-gcflags="-m" reports inlining and escape analysis decisions: tells you exactly what's heap-allocating and why. nm sorted by size finds bloated symbols. Use before reaching for pprof on allocation-heavy paths.
dlv (Delve) debug
dlv debug ./cmd/app dlv debug ./cmd/app -- --flag=value dlv test ./pkg/mypackage/ -- -test.run TestMyFunc dlv attach <pid> dlv exec ./bin/app dlv connect localhost:2345 # inside dlv: break main.main, continue, next, step, # print <var>, goroutines, stack, watch -r <expr>
The Go debugger. dlv test debugs a specific test without running the whole suite. Build with -gcflags="all=-N -l" to disable inlining and optimisations; otherwise variable inspection is unreliable. dlv connect attaches to a headless server for remote/container debugging.
go vetstd lint
go vet ./... go vet -composites=false ./... go vet -printf=true -shadow=true ./... # run all available analysers: go tool vet help go vet -json ./... 2>&1 | jq .
Zero-dependency static analysis: catches printf verb mismatches, unreachable code, mutex copies, and suspicious composite literals. Run before golangci-lint; it's faster and its findings are always actionable.
gofumpt lint
gofumpt -l -w . gofumpt -d main.go gofumpt -l . | xargs -r false # enforce in CI (exit non-zero if unformatted): test -z "$(gofumpt -l .)"
Stricter superset of gofmt: enforces extra blank line rules and grouping conventions that gofmt doesn't. Fully deterministic. Use instead of gofmt, not alongside it. Include in golangci-lint via enable: [gofumpt].
golangci-lint lint
golangci-lint run golangci-lint run --fix golangci-lint run --out-format github-actions ./... golangci-lint run --new-from-rev=HEAD~1 golangci-lint linters golangci-lint run --print-issued-lines=false --print-linter-name
Meta-linter: runs staticcheck, errcheck, gosec, gofumpt, and 50+ more in parallel. Configure via .golangci.yml. --new-from-rev only lints changed code: essential for adopting lint on legacy repos without a big-bang fix.
go modstd modules
go mod tidy go mod tidy -diff go mod vendor go mod why github.com/some/dep go mod graph | grep github.com/some/dep go mod download -json | jq '.Path + "@" + .Version'
tidy -diff (Go 1.23+) shows what tidy would change without writing: safe to run in CI as a check. why traces the import chain that requires a dependency. graph piped to grep finds all consumers of a dep.
go liststd modules
go list -m all go list -m -u all 2>/dev/null | grep '\[v' go list -m -json all | jq 'select(.Indirect == false) | .Path' go list -f '{{.ImportPath}} {{.Deps}}' ./... | tr ' ' '\n' | sort -u go list -tags integration -f '{{.TestGoFiles}}' ./...
Package and module inspection: find upgradeable deps (-u), list direct dependencies, enumerate test files by build tag. Underused relative to its power; avoids third-party dependency graph tools entirely.
go workstd modules
go work init ./app ./lib go work use ./newmodule go work sync GOWORK=off go build ./... # always add go.work and go.work.sum to .gitignore # unless deliberately sharing workspace across the repo
Multi-module workspace mode: develop across modules simultaneously without replace directives. GOWORK=off verifies that module boundaries are correct before pushing. Do not commit go.work in library repos.
govulncheckstd modules
go install golang.org/x/vuln/cmd/govulncheck@latest govulncheck ./... govulncheck -json ./... | jq '.findings[] | select(.trace != null)' govulncheck -mode=binary bin/app govulncheck -C /path/to/module ./...
Go team's vulnerability scanner: checks against the Go Vulnerability Database. Critically, only reports vulns in code paths actually reachable from your binary, not every vuln in every transitive dep. Far fewer false positives than generic SCA tools. From golang.org/x/vuln.
goreleaser release
goreleaser init goreleaser check goreleaser build --snapshot --clean goreleaser release --snapshot --clean goreleaser release --skip=publish # in GitHub Actions on tag push: # uses: goreleaser/goreleaser-action@v6
Cross-platform build matrix, archive creation, checksum generation, changelog from commits, GitHub/GitLab release publishing: all from a single .goreleaser.yaml. --snapshot builds without publishing, safe to run on every PR to validate the release config.
ko release
ko build ./cmd/app KO_DOCKER_REPO=registry.example.com/myapp ko build ./cmd/app --push ko build ./cmd/app --sbom=spdx --platform=linux/amd64,linux/arm64 ko apply -f k8s/deployment.yaml ko resolve -f k8s/ | kubectl apply -f -
Build and push minimal distroless container images for Go binaries without a Dockerfile. ko apply resolves image references in manifests and deploys in one step. Built-in SBOM generation and multi-arch support. Pairs naturally with cosign.
No tools match this filter.