Course for Go engineers

Ship your own Go linter this weekend

Build production static analyzers on the Go team's analysis framework. From AST walk to go vet plugin.

Get the course — $19 Instant access. Yours forever.
nilcheck/analyzer.go
// A minimal analyzer the course builds in module 2
var Analyzer = &analysis.Analyzer{
    Name: "nilcheck",
    Doc:  "reports guaranteed nil derefs",
    Requires: []*analysis.Analyzer{inspect.Analyzer},
    Run: run,
}

func run(pass *analysis.Pass) (any, error) {
    insp := pass.ResultOf[inspect.Analyzer]
    insp.Preorder(nodes, func(n ast.Node) {
        pass.Reportf(n.Pos(), "nil deref")
    })
    return nil, nil
}

Why most Go engineers never write one

go/ast has 40+ node typesThe docs assume you already know which one holds the expression you care about.
3 days lost to type infoWiring go/types and SSA together by trial and error eats a full sprint.
Zero tested examplesEvery blog post stops at "hello world" and never covers a real diagnostic with fixes.

What's inside

01Walk any Go AST with go/ast and the inspector pass
02Wire go/types to resolve identifiers and method sets
03Emit precise diagnostics with positions and severity
04Attach suggested fixes that gopls applies automatically
05Compose analyzers with Requires and ResultOf
06Ship as a go vet plugin and test with analysistest

The 6 lessons

1The analysis.Analyzer contract22 min
2Building nilcheck from an empty file34 min
3Type-aware analysis with go/types41 min
4SuggestedFix and gopls integration28 min
5Fact passing across packages31 min
6Testing and shipping with analysistest26 min

One price. Every lesson.

$39$19
one-time payment
Get instant access
30-day money-back guarantee
Instant download · source code included

Not ready? Take lesson 2 free

The full "Building nilcheck from an empty file" lesson, source included.