Staticcheck analyzers for Bazel's nogo, packaged as a bzlmod module.
This module provides individual staticcheck analyzers that can be used with nogo in Bazel projects using bzlmod.
Add the module to your MODULE.bazel:
bazel_dep(name = "nogo_analyzer_bzlmod", version = "0.1.0")
To use an unreleased version from the repository, you can use git_override:
bazel_dep(name = "nogo_analyzer_bzlmod", version = "0.1.0")
git_override(
module_name = "nogo_analyzer_bzlmod",
remote = "https://github.com/jaeyeom/nogo-analyzer-bzlmod.git",
commit = "<commit-sha>",
)
In your BUILD.bazel file where you define your nogo target:
load("@rules_go//go:def.bzl", "nogo")
load("@nogo_analyzer_bzlmod//:def.bzl", "ANALYZERS", "staticcheck_analyzers")
nogo(
name = "nogo",
deps = staticcheck_analyzers(ANALYZERS),
visibility = ["//visibility:public"],
)
To exclude specific analyzers, use the - prefix:
nogo(
name = "nogo",
deps = staticcheck_analyzers(ANALYZERS + ["-U1000", "-ST1000"]),
visibility = ["//visibility:public"],
)
You can also specify only the analyzers you want:
nogo(
name = "nogo",
deps = staticcheck_analyzers(["SA1000", "SA1001", "SA1002"]),
visibility = ["//visibility:public"],
)
The module includes all staticcheck analyzer categories:
| Category | Description |
|---|---|
| QF | Quickfix suggestions |
| S | Simple code simplifications |
| SA | Staticcheck (bugs and correctness) |
| ST | Stylecheck (code style) |
| U | Unused code detection |
See staticcheck.dev/docs/checks for detailed documentation of each analyzer.
Releases are signed with GitHub artifact attestations,
which produce SLSA build provenance for the source
archive. Each release asset nogo-analyzer-bzlmod-vX.Y.Z.tar.gz is
published alongside nogo-analyzer-bzlmod-vX.Y.Z.tar.gz.intoto.jsonl
(the Sigstore bundle, following the naming convention expected by the
Bazel Central Registry).
From a machine with internet access, the GitHub CLI fetches the attestation and the trusted roots automatically:
gh attestation verify nogo-analyzer-bzlmod-vX.Y.Z.tar.gz \
--repo jaeyeom/nogo-analyzer-bzlmod
If you already have the .intoto.jsonl bundle downloaded alongside the
archive, you can skip the attestation lookup and point gh at the
bundle directly (still requires network access to fetch Sigstore
trusted roots):
gh attestation verify nogo-analyzer-bzlmod-vX.Y.Z.tar.gz \
--repo jaeyeom/nogo-analyzer-bzlmod \
--bundle nogo-analyzer-bzlmod-vX.Y.Z.tar.gz.intoto.jsonl
Fully offline verification additionally requires a pre-exported
trusted_root.jsonl. Generate it on an online machine, then import
everything into your air-gapped environment. See
Verifying artifact attestations offline
for the full procedure.
On an online machine:
gh attestation trusted-root > trusted_root.jsonl
Transfer trusted_root.jsonl, the archive, and the .intoto.jsonl
bundle into the offline environment (along with the gh CLI), then
run:
gh attestation verify nogo-analyzer-bzlmod-vX.Y.Z.tar.gz \
--repo jaeyeom/nogo-analyzer-bzlmod \
--bundle nogo-analyzer-bzlmod-vX.Y.Z.tar.gz.intoto.jsonl \
--custom-trusted-root trusted_root.jsonl
MIT
0.1.02026-01-08 |