gohawk

command module
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 30, 2026 License: MIT Imports: 2 Imported by: 0

README

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 default profile.
gohawk ./...

# See every analyzer, its profile, and its group.
gohawk list

# Inspect an analyzer or one of its checks.
gohawk doc contextpolicy
gohawk doc contextpolicy/nil-context

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

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

# Run selected opt-in analyzers, or exclude one from the defaults.
gohawk -enable=wirepolicy,globalstate ./...
gohawk -disable=oncepolicy ./...

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

# Run one opt-in check.
gohawk -enable-checks=contextpolicy/test-context ./...

# Remove groups from the default profile or from -enable-all.
gohawk -disable-groups=testing ./...

# 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.

Documentation

Overview

Command gohawk runs the gohawk static analyzers.

Directories

Path Synopsis
Package analysisutil contains unsupported syntax and type helpers shared by analyzer implementations and integrations.
Package analysisutil contains unsupported syntax and type helpers shared by analyzer implementations and integrations.
ssa
Package ssautil contains shared helpers for SSA-backed analyzers.
Package ssautil contains shared helpers for SSA-backed analyzers.
Package analyzers provides a curated collection of static analyzers for Go.
Package analyzers provides a curated collection of static analyzers for Go.
internal
analyzerbase
Package analyzerbase provides implementation infrastructure shared by gohawk's analyzer groups.
Package analyzerbase provides implementation infrastructure shared by gohawk's analyzer groups.
analyzers/contracts
Package contracts provides API and data contract analyzers.
Package contracts provides API and data contract analyzers.
analyzers/ownership
Package ownership provides ownership and lifecycle analyzers.
Package ownership provides ownership and lifecycle analyzers.
analyzers/reliability
Package reliability provides reliability and safety analyzers.
Package reliability provides reliability and safety analyzers.
analyzers/testing
Package testingchecks provides analyzers for Go test code.
Package testingchecks provides analyzers for Go test code.
cli
Package cli implements the gohawk command.
Package cli implements the gohawk command.
cmd/gendocs command
Command gendocs synchronizes analyzer metadata with the documentation site.
Command gendocs synchronizes analyzer metadata with the documentation site.
cmd/measure command
Command measure runs a command and records its wall time, peak resident memory, and exit status for the dogfooding benchmark harness.
Command measure runs a command and records its wall time, peak resident memory, and exit status for the dogfooding benchmark harness.
docexamples
Package docexamples runs analyzers against the living examples used by the documentation site.
Package docexamples runs analyzers against the living examples used by the documentation site.
plugin
golangci
Package golangci registers gohawk as a golangci-lint module plugin.
Package golangci registers gohawk as a golangci-lint module plugin.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL