yze — gomatic analyzer family
yze is the gomatic analyzer family: a suite of go/analysis analyzers that encode the gomatic Go standards (sentinel error constants, value receivers, named parameter types, the three-tier CLI layout, …), built on a shared framework so each analyzer is a small, uniform repository. The stickler runner orchestrates this suite alongside golangci-lint; see docs.stickler for the runner.
Architecture
go-yze framework library (diagnostic schema, registration, fix engine, checker driver)
▲
yze-<name> one analyzer per repo (e.g. yze-errconst)
▲
yze aggregator multichecker — runs the suite, emits stickler-json
Analyzers are flat-named yze-<name> (there is no language segment — the suite is all Go), and each emits the stable rule id yze/<name>. Analyzers carry category tags (errors, naming, types, immutability, structure, patterns, testing, …) as metadata, used for --category filtering and these docs.
Components
- go-yze — the framework: the normalized
Diagnostic/Reportschema (stickler-json),Registration,ToDiagnostic, the sharedApplyFixesengine, thechecker-basedRundriver, andApplyConfig(per-analyzer settings → analyzer flags). A pure library. - yze — the aggregator: a
go/analysismultichecker over every analyzer;--categoryfiltering, stickler-json/text output,--fix, and--config(per-analyzer settings). yze-<name>— one analyzer per repository (standard*analysis.Analyzer+Registration,analysistestfixtures, standalone binary). The current suite:
| Rule | What it enforces | Category |
|---|---|---|
yze/errconst | no errors.New / fmt.Errorf — wrap via errs.Const.With (exempt defaults to go-error itself) | errors |
yze/errlast | error is the last return value | errors |
yze/gotostmt | no goto | patterns |
yze/ctxfirst | context.Context is the first parameter | patterns |
yze/namedtypes | named domain types for parameters | types |
yze/anonstruct | no anonymous struct types | types / structure |
yze/emptyiface | any, not interface{} (autofix) | modern-go |
yze/boolname | boolean predicate/flag naming | naming |
yze/ptrrecv | value receivers (no pointer receivers without a no-copy field) | immutability |
yze/ptrparam | value parameters (no pointer params except idiomatic stdlib) | immutability |
yze/stdlog | log/slog, not the log package | data |
yze/pkgstd | three-tier command-package standards (per-package) | structure |
yze/layout | three-tier command↔domain correspondence (cross-package) | structure |
yze/testfile | unit-test files 1:1 with source | testing |
Configuration
ptrrecv and ptrparam accept a configurable -allow list of additional types. Settings flow through yze --config (or stickler’s layered config), keyed by analyzer name.
Fixes
Analyzers attach native analysis.SuggestedFix edits when a safe, deterministic fix exists; the shared go-yze ApplyFixes engine applies them (yze --fix), and gopls surfaces them as editor quick-fixes for free.