Essential DevTools Every Go Developer Should Know
Go ships with a powerful standard toolchain that many developers underestimate. Beyond writing code, knowing your tools is what separates a developer who fights their environment from one who moves efficiently through it. This article walks through the essential Go dev tools — what they do, when to use them, and why they matter.
1. go run — Fast Feedback Loop
go run main.go
go run compiles and executes a Go program in a single step without producing a binary artifact. Internally, it compiles to a temporary directory and runs the resulting binary. It's not for production — it's your rapid iteration tool during development.
For multi-file packages:
go run .
2. go build — Producing Binaries
go build -o bin/myapp .
Go compiles to a statically linked binary by default — no runtime, no VM, no dependencies on the host system. This makes deployment straightforward: copy the binary and run it.
You can cross-compile for different OS/architectures using environment variables:
GOOS=linux GOARCH=amd64 go build -o bin/myapp-linux .
This is particularly powerful for building Linux binaries from a Mac or Windows machine.
3. go fmt — Enforced Code Style
go fmt ./...
Go enforces a single, non-negotiable code style via go fmt. There are no style debates in Go teams — the formatter decides. It uses tabs for indentation and has strict rules on spacing, braces, and imports.
Most editors run this on save via gopls. You should also enforce it in CI to reject unformatted code.
4. go vet — Static Analysis
go vet ./...
go vet performs static analysis to catch bugs the compiler won't flag — mismatched Printf format verbs, incorrect struct tags, unreachable code, suspicious composite literals, and more.
It's lightweight and fast. Run it before every commit. In CI, a failing go vet should block a merge.
5. go test — Built-in Testing Framework
Go has testing built into the standard library — no third-party framework needed.
go test ./... # Run all tests
go test -v -run TestFunctionName ./... # Run a specific test with verbose output
go test -race ./... # Run with race condition detector
go test -cover ./... # Show test coverage
Test files follow the _test.go naming convention. The race detector (-race) is particularly valuable — it instruments memory accesses at runtime to detect concurrent data races, which are otherwise very hard to catch.
6. gopls — The Go Language Server
gopls is the official Go language server implementing the Language Server Protocol (LSP). It powers editor features like:
- Intelligent autocompletion
- Go-to-definition and find-references
- Inline diagnostics and error highlighting
- Automatic imports management
- Refactoring (rename, extract function)
It integrates with VS Code (via the Go extension), Neovim (via nvim-lspconfig), GoLand, and most modern editors. For VS Code, installing the official Go extension is all you need — gopls is bundled and managed automatically.
7. Delve (dlv) — The Go Debugger
go install github.com/go-delve/delve/cmd/dlv@latest
Delve is the standard debugger for Go. It understands Go's runtime, goroutines, and data structures — unlike GDB, which doesn't handle Go well.
dlv debug main.go # Start debugging
dlv test ./pkg/... # Debug tests
Common commands inside the Delve REPL:
break main.main # Set breakpoint
continue # Run until breakpoint
next # Step over
step # Step into
print variableName # Inspect a variable
goroutines # List all goroutines
Delve integrates with VS Code's debug panel, so you can set breakpoints and inspect state visually without touching the CLI.
8. golangci-lint — Unified Linting
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
golangci-lint run ./...
golangci-lint runs multiple linters in parallel under a single binary. It includes staticcheck, errcheck, gosec, gocritic, and many others. Running each separately would be slow and painful — this bundles them efficiently.
Configure it via .golangci.yml at the root of your project:
linters:
enable:
- errcheck
- gosimple
- staticcheck
- unused
- govet
This is the standard linting tool used in professional Go CI pipelines.
9. air — Live Reload
go install github.com/air-verse/air@latest
air
air watches your project for file changes and automatically rebuilds and restarts your application. Essential for web server or API development where you'd otherwise be manually stopping and restarting on every change.
Configure it via .air.toml:
[build]
cmd = "go build -o ./tmp/main ."
bin = "./tmp/main"
include_ext = ["go", "html", "env"]
10. go mod — Module and Dependency Management
Go modules are the built-in dependency management system, introduced in Go 1.11 and now the standard.
go mod init github.com/username/myapp # Initialize module
go get github.com/some/package # Add dependency
go mod tidy # Remove unused, add missing
go mod vendor # Vendor dependencies locally
Dependencies are declared in go.mod and locked with checksums in go.sum. No separate package manager, no node_modules-style chaos.
Putting It All Together: A Practical Workflow
# During development
air # Live reload running in background
# Before committing
go fmt ./... # Format
go vet ./... # Static analysis
go test -race -cover ./... # Tests with race detection and coverage
golangci-lint run ./... # Lint
# Building for production
GOOS=linux GOARCH=amd64 go build -o bin/myapp .
Summary
| Tool | Purpose |
|---|---|
go run |
Run without producing a binary |
go build |
Compile to a static binary |
go fmt |
Enforce standard code formatting |
go vet |
Static analysis for common bugs |
go test |
Run tests, coverage, race detection |
gopls |
Language server for editor intelligence |
dlv (Delve) |
Debugger with goroutine awareness |
golangci-lint |
Unified multi-linter |
air |
Live reload during development |
go mod |
Module and dependency management |
Go's tooling is opinionated by design — and that's a feature, not a limitation. The less time you spend configuring your environment, the more time you spend building. Master these tools early and they'll stay with you throughout your Go career.
Suggested Dev.to tags: #go #golang #devtools #beginners
Top comments (0)