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:
  • General enthusiasm for Go's language design and its built-in tooling/linting philosophy
  • Practical endorsement: the framework enables teams to codify review knowledge into custom linters
  • Skepticism about the submission's novelty, noting the framework is already widely used
  • Curiosity about extending the framework to higher-level architectural linting
  • Appreciation for Go team's tooling focus as beneficial for both human and AI-assisted development