← All projects
Project record1 mention
Originally shared on Hacker News

Gohawk

Gohawk is a static analysis tool for Go that catches resource leaks and concurrency errors, such as HTTP response bodies not closed on all paths, goroutine leaks, and lock inversions. It builds a symbolic heap model of the program under analysis to track object references with high accuracy, an approach generalized from Meta's Infer. It has been used to find bugs in Caddy, Docker, and Kubernetes, and from a cold cache analyzes Docker in around 13s and Kubernetes in around 76s. Features include rustc-inspired rich diagnostics with full error lineage, a documentation website at gohawk.dev, and a custom analysis runner replacing go vet.

Last shared
01 / The problem

What it addresses

Staticcheck and other existing Go linters do not yet cover resource leaks and concurrency errors in Go code.

02 / Source history

Shared over time

Each entry reflects what was shared on that date. Details may have changed since then.

  1. Gohawk

    Gohawk is a static analysis tool for Go that catches resource leaks and concurrency errors, such as HTTP response bodies not closed on all paths, goroutine leaks, and lock inversions. It builds a symbolic heap model of the program under analysis to track object references with high accuracy, an approach generalized from Meta's Infer. It has been used to find bugs in Caddy, Docker, and Kubernetes, and from a cold cache analyzes Docker in around 13s and Kubernetes in around 76s. Features include rustc-inspired rich diagnostics with full error lineage, a documentation website at gohawk.dev, and a custom analysis runner replacing go vet.

    Problem: Staticcheck and other existing Go linters do not yet cover resource leaks and concurrency errors in Go code.

    Posted by @its-malbolge-ti · Original source ↗

    Story title · @its-malbolge-ti · · Source ↗

    Show HN: Gohawk – A Resource Leak and Concurrency Static Analyzer for Go

    Submitted URL · @its-malbolge-ti · · Source ↗

    https://gohawk.dev/

    Source text · @its-malbolge-ti · · Source ↗

    I've been working really hard on a static analysis tool called gohawk

    Source text · @its-malbolge-ti · · Source ↗

    It's meant to catch resource leaks and concurrency errors in Go code

    Source text · @its-malbolge-ti · · Source ↗

    have successfully used it to find bugs in Caddy / Docker / k8s (links in the README)

    Source text · @its-malbolge-ti · · Source ↗

    I built this tool after realizing that Staticcheck and other linters don't really cover this ground yet.

    Source text · @its-malbolge-ti · · Source ↗

    It works by building a symbolic heap model of the program under analysis, so that it can track object references with a high degree of accuracy.

    Source text · @its-malbolge-ti · · Source ↗

    It's also capable of detecting certain types of goroutine leaks / lock inversions.

    Source text · @its-malbolge-ti · · Source ↗

    From a cold cache, it's able to analyze Docker in around 13s, and the whole of Kubernetes around 76s.

    Source text · @its-malbolge-ti · · Source ↗

    Documentation website (https://gohawk.dev) -- Contains detailed overview of all the supported analyzers.

    Source text · @its-malbolge-ti · · Source ↗

    Really rich diagnostics (I took inspo from rustc -- the full lineage of the error gets reported, including error spans)