Documentation
¶
Overview ¶
Package budgetfile compares measured sizes against a committed baseline.
Baselines live in testdata/budgets/<file>.json (one file per package, so parallel changes do not collide). A plain `go test` only reads them; they are rewritten solely when HM_BUDGETS_UPDATE=1 (see `make budgets-update`). The package is a leaf: standard library only.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Check ¶
Check fails t when got exceeds baseline+tolerance or the cap, or when key is missing from the file. It always logs
BUDGET <file>/<key> got=N baseline=N limit=N unit=U status=ok|FAIL|under
With HM_BUDGETS_UPDATE=1 it instead rewrites the metric's value (keeping Tol*/Cap; a new key is added with def), requires HM_BUDGETS_REASON, appends a history line and never fails on size.
func CheckAllocs ¶
CheckAllocs runs bench three times (testing.Benchmark) and checks the minimum allocs/op and bytes/op as <name>_allocs and <name>_bytes. Allocation counts are deterministic where wall clock is not. It skips under -short and -race (the race detector changes allocation behaviour).