Documentation
¶
Overview ¶
Command apimanifest renders the exported API of a set of packages as canonical text.
It exists because a count of exported symbols does not define an API. Removing one function and adding another keeps the count identical and breaks every caller, which is how a project can watch a number and still ship a breaking change. What defines an API is its structure: which packages exist, what they export, and the exact shape of every signature, field and method set.
The output is a committed snapshot. CI regenerates it and diffs; any change to the public surface therefore appears in a pull request as a change to a file somebody has to approve. That is the whole mechanism — it does not decide whether a change is acceptable, it makes the change impossible to miss.
Usage:
go run ./internal/tools/apimanifest -dir . -out api/orm.txt <packages...>
The rendering is derived from go/types rather than from source text, so it reports what the compiler sees: an embedded field's promoted methods, a type alias's target, an inferred constraint. Nothing here parses Go with regular expressions.