Watch for bugs like a hawk!
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.
cache.go
1func refresh() {
2 index.Lock()
3 defer index.Unlock()
4 cache.Lock()
5 defer cache.Unlock()
6}
7
8func reset() {
9 cache.Lock()
10 defer cache.Unlock()
11 index.Lock()
12 defer index.Unlock()
13}
lockordercontradictory lock order: index and cache
Better together
gohawk complements your existing analyzers such as go vet, Staticcheck, and
go-critic; it does not try to replace them.
Easy to drop in
gohawk runs as a standalone tool or as a go vet tool. No configuration file,
and every check is a command-line flag.
Analysis features
gohawk analyzers are primarily focused on enforcing reliability around resource management, concurrency, and error handling.
Rich diagnostics
Each finding pinpoints the offending code with a precise source span, shows the evidence behind it, such as the return that leaks a file, and says how to fix it.