Skip to content

Repository files navigation

gohawk logo: a hawk sheltering the Go gopher

gohawk

CI Coverage

gohawk is a focused set of static analyzers for Go, designed to run alongside go vet, Staticcheck, and go-critic. It covers gaps around ownership, lifecycle, concurrency, API contracts, and path-aware policy checks.

It draws inspiration from go-critic, but is deliberately more focused on correctness and reliability, with fewer opinionated style checks.

Read the documentation

Quick Start

# Install.
go install github.com/kojah/gohawk@latest

# 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)" ./...

# Preview safe fixes, then apply them.
gohawk -fix -diff ./...
gohawk -fix ./...

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

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

# Run one extended check.
gohawk -enable-checks=lockorder/contradictory-order ./...

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

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

golangci-lint integration

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.

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.

Sponsorship

If gohawk is useful to you or your organization, consider sponsoring its continued development. Sponsorship helps fund maintenance, new analyzers, and improvements to the documentation and developer experience. To discuss sponsorship, get in touch with @kojah.

License

Licensed under the MIT License.

About

Watch for bugs like a hawk!

Resources

Contributing

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages