dkorunic/betteralign
Detect and fix suboptimal struct field layout in Go: reduces padding and GC pointer bytes, rewrites files while preserving comments. A drop-in fieldalignment replacement. observed · 2026-10-12
Health v2 · maintenance only
98/100
- Activity 99
- Release rhythm 99
- Longevity 93
How is this computed?
round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10) — computed 2026-10-21. Adoption (stars, forks) is never an input.
- gap_med: 18
- age_days: 1315
- days_rel: 10
- days_push: 10
- n_releases_24m: 34
Adoption not part of the score
1087 stars · 23 forks observed · 2026-10-12
What it is AI-extracted, prompt v1, taxonomy v1, 2026-08-30, confidence not recorded
betteralign is a Go static analysis tool that detects structs whose fields could be reordered to reduce memory usage, and can optionally rewrite them safely. It is a fork of the official fieldalignment analyzer with improvements like comment preservation, atomic writes, and safer skip/ignore controls.
Use cases
- reduce memory usage of Go structs by reordering fields
- find structs with suboptimal field alignment in a Go codebase
- automatically fix struct field ordering without losing comments
- detect positional composite literals that would break if fields are reordered
- run fieldalignment analysis in CI with opt-in or opt-out annotations
When to choose
- you want memory savings from struct field reordering in Go
- you need comment-preserving rewrites that the upstream fieldalignment tool lacks
- you have generic structs or positional literals that crash or break upstream tooling
When to avoid
- your project is not written in Go
- you only care about anonymous structs, which are deliberately skipped
- you need atomic rewrite guarantees on Windows
Facets
cli-tool · maturity active
linter formatter developer-tools developer-tools performance programming-languages go cli windows struct-alignment memory-optimization static-analysis code-rewriting golang-analyzer linux macos
1 source
- readme: https://github.com/dkorunic/betteralign · fetched 2026-10-12 · 5e0794314b32
Member repositories
| Repository | Role | Health v2 |
|---|---|---|
| dkorunic/betteralign | main | 98 |
For agents
markdown · JSON · MCP: product_card(name="dkorunic/betteralign")
Data as of 2026-10-19T08:05:51.212177+00:00 · Report a problem