Using and Writing Go Analyses
summary
Shows how to write a real analyzer using the Analysis API, builds a checker that detects cmp.Equal pointer vs value mismatch by combining the inspect pass with types info, reports precise Diagnostics with source positions, and runs via singlechecker.Main as a standalone check tool. Demonstrates the run function that filters CallExpr nodes, compares argument types, emits an error when types differ, and plugs analyzers into go vet, staticcheck and gopls so the check runs in editors and CI.
AI-written summary · about
chapters (7)
- 0:00Introduction to go analysis
- 1:14Identifying a common pitfall
- 4:25The power of static analysis
- 7:45Analyzing syntax and types
- 10:26Writing the analyzer code
- 14:16Running and sharing tools
- 17:21Conclusion and Q&A








