GolangCI integration
gohawk integrates with golangci-lint through its module plugin system. Module plugins are compiled into a custom golangci-lint binary, so they do not require a separate plugin file at runtime.
Build a custom binary
Create .custom-gcl.yml in the root of your project:
version: v2.13.2name: custom-gcldestination: .plugins: - module: github.com/kojah/gohawk import: github.com/kojah/gohawk/plugin/golangci version: vX.Y.ZReplace vX.Y.Z with the gohawk release you want to use. Build the custom
binary with Go 1.26 or newer. The build toolchain must be at least as new as
the code the resulting binary will analyze:
go run github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.13.2 customThis writes custom-gcl to the current directory.
Configure gohawk
Enable the custom linter in .golangci.yml:
version: "2"
linters: default: none enable: - gohawk settings: custom: gohawk: type: module description: Correctness-focused ownership, lifecycle, and concurrency checks. settings: enable: - channelsafety disable: - lockorder enable-checks: - producerlifecycle/stopped-loop-send disable-checks: - deferinloop/cleanup-lifetimeThe plugin runs gohawk’s core checks; experimental checks are suppressed
unless explicitly enabled. Its
settings accept enable and disable analyzer lists, enable-checks and
disable-checks lists of stable check IDs, or enable-all: true to start with
every analyzer and check. Explicitly enabling a check also enables its owning
analyzer, unless that analyzer is explicitly disabled. Run gohawk list and
gohawk list -checks to see valid names and check IDs.
See Configuration for tiers and analyzer-selection behavior.
Run it
Use the generated binary in place of the standard golangci-lint executable:
./custom-gcl runRebuild the custom binary after changing the gohawk or golangci-lint version in
.custom-gcl.yml.