dlv)Popular debugger for Go.
go install github.com/go-delve/delve/cmd/dlv@latest
dlv debug ./cmd/myapp
Set breakpoints, step, inspect goroutines and locals.
go test -race ./...
go run -race .
Catches unsynchronized memory access; expect slower execution.
go test -cpuprofile=cpu.prof -memprofile=mem.prof ./...
go tool pprof cpu.prof
In pprof interactive mode, top, list, web (with graphviz) help locate hotspots.
go test -trace=trace.out ./...
go tool trace trace.out
Shows scheduler latency, blocking syscalls, and GC pauses.
pprof HTTP endpointsnet/http/pprof registers handlers for live profiling in servers (protect in production with auth/network rules).
fmt.Printf, log.Printf, or structured log/slog with levels — still valid; prefer context-rich logs in services.
go vet and staticcheckCatch common mistakes before runtime:
go vet ./...
go install honnef.co/go/tools/cmd/staticcheck@latest
staticcheck ./...