← Back to Tech Radar
Hacker News tech

Go Analysis Framework: modular static analysis by go team

Trending on Hacker News: Go Analysis Framework: modular static analysis by go team (162 points / 32 comments, via pkg.go.dev)

In one line

Package analysis defines the interface between a modular static analysis and an analysis driver program.

Opening excerpt

A static analysis is a function that inspects a package of Go code and reports a set of diagnostics (typically mistakes in the code), and perhaps produces other results as well, such as suggested refactorings or other facts. An analysis that reports mistakes is informally called a “checker”. For example, the printf checker reports mistakes in fmt.Printf format strings.

A “modular” analysis is one that inspects one package at a time but can save information from a lower-level package and use it when inspecting a higher-level package, analogous to separate compilation in a toolchain. The printf checker is modular: when it discovers that a function such as log.Fatalf delegates to fmt.Printf, it records this fact, and checks calls to that function too, including calls made from another package.

By implementing a common interface, checkers from a variety of sources can be easily selected, incorporated, and reused in a wide range of driver programs including command-line tools (such as vet), text editors and IDEs, build and test systems (such as go build, Bazel, or Buck), test frameworks, …

(Excerpted from the original; full article via the source link below.)

This story hit the Hacker News front page today (162 points / 32 comments, via pkg.go.dev). Our Tech Radar aggregates daily signals on AI engineering, backend architecture and DevOps — browse the related services and further reading below, or get in touch with our team.

Source: Hacker News

Related Services