Go Stack¶
Tools¶
| Purpose | Tool | Config |
|---|---|---|
| Formatter | gofumpt | (no config file, stricter than gofmt) |
| Linter | golangci-lint | stacks/go/.golangci.yml template |
| Type checker | go vet | (built into toolchain) |
| Test runner | go test | (built into toolchain) |
| Build | go build | (built into toolchain) |
All tools except the Go toolchain itself are managed by mise.
mise.toml (generated)¶
Project layout¶
my-service/
├── go.mod
├── go.sum
├── .golangci.yml
├── Dockerfile
├── cmd/
│ └── main.go
└── internal/
└── app/
├── app.go
└── app_test.go
Formatter — gofumpt¶
gofumpt is a stricter superset of gofmt. It enforces additional formatting rules on top of the Go standard.
golangci-lint is configured to enforce gofumpt-compatible formatting via the gofumpt linter.
Linter — golangci-lint¶
Runs the configured golangci-lint suite in a single pass. Configuration comes
from the stacks/go/.golangci.yml template.
Key linters enabled:
| Linter | Catches |
|---|---|
errcheck |
Unchecked error returns |
gosimple |
Simplifiable code |
govet |
Suspicious constructs |
ineffassign |
Ineffectual assignments |
staticcheck |
Bugs, performance, style |
gofumpt |
Formatting violations |
goimports |
Import ordering |
misspell |
Spelling errors |
unconvert |
Unnecessary type conversions |
Type checker — go vet¶
Go's type system is enforced at compile time. go vet provides the closest equivalent to a standalone static analysis pass.
Test runner — go test¶
CGO is disabled for reproducibility. Generated tests use t.Parallel() for intra-package parallelism:
Docker¶
Generated Go projects include a multi-stage Dockerfile:
- Builder —
golang:1.23-alpine, compiles the binary - Runtime —
gcr.io/distroless/static-debian12, ships only the binary
The Docker build is validated during mise run verify.
CGO¶
All build and test tasks set CGO_ENABLED=0 to produce statically-linked binaries compatible with distroless images.