Skip to Content
marmot
Commands

Check the workspace (every module of go.work, or the current module) the way gofmt, goimports, go vet, golangci-lint (with .golangci.yml when present), go fix, govulncheck, go mod tidy, cross builds and deadcode would, on one package graph in one process. Results are cached per package, so an unchanged tree is answered at once and an edit reanalyzes only what it affects. Prints one line per finding and one line per check; exits 1 when a gating check fails (modernize and deadcode only report).

Usage
marmot check [packages] [flags]

Examples

marmot check
marmot check -changed
marmot check -changed main -only vet,lint
marmot check -json ./internal/...

marmot check runs the checks a project usually runs one by one in CI, in one process over one package graph. With no packages it checks every module of the go.work, or the current module.

CheckReportsFails the run
fmtfiles gofmt or goimports would changeyes
vetthe analyzers of the installed go vetyes
lintthe golangci-lint standard set (staticcheck, errcheck, govet, ineffassign, unused) and the gosec file permission rules; reads a v2 .golangci.ymlyes
goplswhat gopls check reportsyes
vulnvulnerabilities the code calls, as govulncheck finds themyes
tidya go.mod or go.sum that go mod tidy would changeyes
crosstype errors on other targets: -targets, scripts/platforms.txt or platforms.txt, else linux, darwin and windows on amd64 and arm64yes
modernizewhat the go fix modernizers would changeno
exhaustiveswitches that miss values of an enum or types of a sealed interface; runs only when -only names it or .golangci.yml enables itno
nildereferences of pointers and writes to maps that can be nilno
deadcodefunctions no program or test reachesno

-only picks checks; -changed [REF] checks only the packages whose files changed since REF (by default origin/main, else main):

marmot check -changed -only vet,lint

Caching

Results are cached per package, keyed by its files and what its dependencies export, so an unchanged tree answers at once and an edit reanalyzes only what it affects (-nocache turns this off). On a workspace of 10 modules and 204 packages, the full set takes 46 s from an empty cache (251 s for the same tools run one by one), 0.7 s when nothing changed and about 1 s after an edit, and stays under 2 GB of memory.

JSON

In JSON mode each finding is a diagnostic object with check and analyzer fields (codes M0100 to M0110), then one {"kind":"check","check":"lint","status":"failed","findings":3,...} object per check, then the result line.

Flags

Flags take one dash or two: -release and --release are the same.

FlagMeaning
-changed stringcheck only what changed against a git ref (-changed alone: origin/main, else main)
-color stringcolor in human output: auto, always or never (NO_COLOR turns auto off) (default "auto")
-detailsshow every finding with its source and suggested fix
-j stringparallel analysis jobs (default: the number of CPUs) (default "0")
-jsonmachine readable output: JSON Lines on stderr (also $MARMOT_OUTPUT=json, and the default under coding agents)
-nocacheanalyze everything again, ignoring cached results
-offlineno network: the vulnerability check is skipped
-only stringrun only these checks, comma separated: fmt,vet,lint,modernize,gopls,exhaustive,nil,vuln,tidy,cross,deadcode
-stagedcheck exactly what git has staged (for a pre-commit hook), not the working tree
-tags stringcomma separated build tags
-targets stringcross build targets, comma separated goos/goarch (default: scripts/platforms.txt, else linux, darwin and windows on amd64 and arm64)
-vprint timing and cache statistics
-watchrun again after every change to the files and report only new and resolved findings

Full help

marmot check --help
Check the workspace (every module of go.work, or the current module) the way gofmt, goimports, go vet, golangci-lint (with .golangci.yml when present), go fix, govulncheck, go mod tidy, cross builds and deadcode would, on one package graph in one process. Results are cached per package, so an unchanged tree is answered at once and an edit reanalyzes only what it affects. Prints one line per finding and one line per check; exits 1 when a gating check fails (modernize and deadcode only report).

Usage:
  marmot check [packages] [flags]

Examples:
marmot check
marmot check -changed
marmot check -changed main -only vet,lint
marmot check -json ./internal/...

Flags:
      --changed string   check only what changed against a git ref (-changed alone: origin/main, else main)
      --color string     color in human output: auto, always or never (NO_COLOR turns auto off) (default "auto")
      --details          show every finding with its source and suggested fix
  -h, --help             help for check
      --j string         parallel analysis jobs (default: the number of CPUs) (default "0")
      --json             machine readable output: JSON Lines on stderr (also $MARMOT_OUTPUT=json, and the default under coding agents)
      --nocache          analyze everything again, ignoring cached results
      --offline          no network: the vulnerability check is skipped
      --only string      run only these checks, comma separated: fmt,vet,lint,modernize,gopls,exhaustive,nil,vuln,tidy,cross,deadcode
      --staged           check exactly what git has staged (for a pre-commit hook), not the working tree
      --tags string      comma separated build tags
      --targets string   cross build targets, comma separated goos/goarch (default: scripts/platforms.txt, else linux, darwin and windows on amd64 and arm64)
      --v                print timing and cache statistics
      --watch            run again after every change to the files and report only new and resolved findings

On this page

Was this page helpful?

Report an issueOpen issues