go-modernizelisted
Install: claude install-skill prilive-com/go-tdd-pack
# Go Modernize
Run Go 1.26's modernization analyzers to bring a package or module up to
current idioms. This is not a required cleanup — it's a periodic pass
that reduces cognitive load for the next reader.
## Prerequisites
- Go 1.26.0 or newer (`go version`). This skill assumes the rewritten
`go fix` that ships with 1.26. If on 1.25 or older, stop — the old
`go fix` only handles API migrations, not idiom modernization.
- Clean working tree. Commit or stash pending changes first.
- Working CI (`go test ./...` passes) before starting.
## Step 1: Survey
```bash
go version # confirm 1.26+
go fix -diff ./... | head -200
```
Skim the diff for:
- **Surprises**: any change you wouldn't want (rare, but possible in
generated code or hand-tuned hot paths). These go on a skip list.
- **Volume**: if it's hundreds of files, split the modernization across
multiple PRs by package/subtree rather than one megadiff.
## Step 2: Know which analyzers run
Go 1.26's `go fix` runs the modernize analyzer set. Key transformations:
| Pattern | Becomes |
|------------------------------------------|--------------------------------------|
| `var x = new(T); *x = v` | `x := new(v)` (Go 1.26 `new(expr)`) |
| `interface{}` | `any` |
| `fmt.Sprintf("%s", x)` where x is string | `x` |
| Manual `min(a, b)` / `max(a, b)` help