Skip to content
kojahPublic

About

Watch for bugs like a hawk! gohawk is a set of static analyzers for Go, focused on concurrency and resource-lifetime bugs.

Topics

Resources

Contributing

Stars

158 stars

Watchers

0 watching

Forks

Latest commit

 

History

1,416 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gohawk logo: a hawk sheltering the Go gopher

gohawk

CI Go 1.26 Go 1.27 Windows Coverage Docs Documentation links VS Code Marketplace Open VSX

gohawk is an industrial-grade static analyzer that finds resource management and concurrency issues in Go code. It has been used to find and fix bugs in Docker, Kubernetes, and Caddy.

gohawk is heavily inspired by Meta's Infer and its compositional summary model. It writes a summary of what each function does with its arguments and results, such as closing a file or waiting for a goroutine, and callers read that summary instead of analyzing the function again. This lets gohawk follow a resource through helpers and across packages.

Read the documentation

Quick Start

Download a binary from GitHub Releases and put it on your PATH. For source builds, see installation.

# Run the conservative default set.
gohawk ./...

# See every analyzer with its tier and group.
gohawk list

# Inspect an analyzer or one of its checks.
gohawk doc lockorder
gohawk doc lockorder/missing-release

# Use it with go vet.
go vet -vettool="$(command -v gohawk)" ./...

# Run a selected analyzer, or exclude one from the defaults.
gohawk -enable=concurrentcapture ./...
gohawk -disable=concurrentcapture ./...

# Run complete analyzer groups with their default checks.
gohawk -enable-groups=concurrency,resources ./...

# Run one experimental check by its ID.
gohawk -enable-checks=producerlifecycle/unclosed-range ./...

# Remove groups from the ordinary run or from -enable-all.
gohawk -disable-groups=concurrency ./...

# Run every analyzer and check.
gohawk -enable-all ./...

VSCode/Cursor extension

The gohawk extension shows findings as you type, with the steps that lead to each one. Search for gohawk in the Extensions view of VS Code or Cursor. The gohawk binary is included.

A gohawk finding in VS Code, with the steps that lead to it and the usual fix

See the extension guide for path stepping and settings.

How gohawk compares to other analyzers

gohawk aims to complement other Go analyzers, not replace them. Deep, flow-based analysis of Go already covers several domains well. NilAway covers nil safety, gosec covers security and taint analysis, and Staticcheck covers a broad range of general bugs. gohawk primarily focuses on resource management and concurrency, which is uncovered ground.

golangci-lint integration

There is no native GolangCI lint integration (yet!), but gohawk can run as a module plugin inside a custom golangci-lint binary. See the golangci-lint integration guide for build and configuration instructions.

Contributing

Contributions are welcome. See How to contribute for the development workflow, analyzer requirements, and verification steps.

Contributors

Thanks to everyone who contributes to gohawk. This image of commit contributors is refreshed daily.

gohawk contributors

See the full contributor history.

AI policy

gohawk was developed with assistance from LLMs, and AI-assisted contributions are permitted. Contributors must disclose AI usage, and every contribution must meet the project's strict standards for quality, testing, analyzer precision, and human readability. See the full AI policy.

License

Licensed under the MIT License.

About

Watch for bugs like a hawk! gohawk is a set of static analyzers for Go, focused on concurrency and resource-lifetime bugs.

Topics

Resources

Contributing

Stars

158 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages