| Go Analysis Framework: modular static analysis by go team(pkg.go.dev) | |
| 212 points by AbuAssar 23 hours ago | 80 comments | |
tl;dr: Go's `analysis` package defines a standard interface for modular static analyzers, where each `Analyzer` exposes a `Run` function operating on a `Pass` (syntax trees, type info, etc.) and reports diagnostics. Analyzers can depend on results from other analyzers and exchange serializable "Facts" across package boundaries—enabling separate-compilation-style analysis (e.g., printf-wrapper detection). The common interface lets tools like `vet`, IDEs, and build systems reuse checkers, with helper subpackages (`singlechecker`, `multichecker`, `analysistest`) for building and testing standalone commands. | |
HN Discussion:
| |