Install¶
| Method | Command | Needs |
|---|---|---|
| mise (recommended) | mise use "github:mpyw/[email protected]" |
Nothing. Installs the prebuilt binary |
go tool |
go get -tool github.com/mpyw/declscope/cmd/declscope@latest |
Go 1.24+ |
go install |
go install github.com/mpyw/declscope/cmd/declscope@latest |
A Go toolchain |
| Release archive | See below | Nothing |
Pin a version, run through go vet, or install from an archive
mise use pins the version in the project's mise.toml, so every checkout and CI run the same one. Add -g to install it for every project on your machine instead.
As a tool dependency in go.mod:
Through go vet, which runs it with the same package loading as the rest of your vet checks:
Without installing anything:
From a release archive, verified against the published checksums:
VERSION=0.11.0
curl -LO "https://github.com/mpyw/declscope/releases/download/v${VERSION}/declscope_${VERSION}_darwin_arm64.tar.gz"
curl -LO "https://github.com/mpyw/declscope/releases/download/v${VERSION}/checksums.txt"
shasum -a 256 -c checksums.txt --ignore-missing
tar xzf "declscope_${VERSION}_darwin_arm64.tar.gz"
Flags¶
| Flag | Default | Effect |
|---|---|---|
-config |
(discovered) | Path to a YAML config file. Skips the .declscope.yaml lookup |
-test |
true |
Analyze *_test.go files as well |
-fix |
false |
Apply suggested fixes |
-diff |
false |
With -fix, print a diff instead of writing files |
-V=full |
Print the version and exit. A build from a checkout answers devel |
-test, -fix and -diff come from go/analysis. declscope -help lists the rest.
Subcommands¶
| Command | What it does | Flags of its own |
|---|---|---|
declscope survey [packages] |
Report what was checked and what it found, one row per package | -format, -test, -config, -allow-errors |
declscope inspect <package> |
Report the shape of one package: its namespaces and the crossings between them | -format, -test, -config |
declscope baseline [packages] |
Record the violations a codebase already has | -config, -o |
declscope skill install |
Install the adoption skill for an AI agent | --agent, --scope |
declscope <subcommand> -help lists each one's flags.