noalloc forces Go code to stay allocation-free as it changes
noalloc: Tooling and libraries to enforce zero heap allocations in Golang
noalloc is a tool and library set that lets you mark Go functions with //noalloc:root and then checks the entire call tree for heap allocations, reporting every offending line. It also ships bounded, fixed-capacity containers (Buf, Vec, Slice, Map) and a zero-allocation JSON encoder/decoder generated by jsongen. The repo is AI-written but used in production at The Consensus; it requires Go 1.27 or later and exits with code 1 on any allocation found.
It's one thing to be able to write some code that doesn't allocate on the heap. It's another thing to be able to keep code from not allocating as the code changes.