# marmot verify (/docs/commands/verify)

<!-- Generated by scripts/gen.mjs from `marmot verify --help` and scripts/commands.mjs. Do not edit by hand. -->

Analyze every function of the named packages (default: the workspace) for operations that can panic at run time. Examples are index and slice bounds, nil dereferences, division by zero and failed type assertions. Each is proved safe, or reported. A manifest finding is a panic that no guard in the code excludes, shown with the input that triggers it. -latent also lists panics that depend on the inputs of their function. Results are cached per package. Findings are notes for now. With -confirm=sandbox, marmot verify runs the package's own functions with generated inputs to confirm findings. They run in a sandbox with no network and no writes outside a temporary directory. Without -confirm, nothing is run.

```text title="Usage"
marmot verify [packages] [flags]
```

## Examples [#examples]

```sh
marmot verify ./...
marmot verify -latent ./internal/codec
marmot verify -confirm=sandbox -search ./internal/codec
marmot verify -json .
```

## What it reports [#what-it-reports]

`marmot verify` looks at each operation that can panic: index and slice bounds, nil dereferences,
division by zero, failed type assertions and others. It proves the operation safe, or it reports it.

- A **manifest** finding is a panic that no guard in the code excludes. The report gives the input that triggers it.
- A **latent** finding depends on the inputs of its function. `-latent` lists these too.

Findings are notes with code [M0120](/docs/diagnostics/codes/m0120). `marmot check -verify` runs the same
analysis together with the other checks.

## Confirm a finding [#confirm-a-finding]

Without `-confirm`, marmot verify runs nothing. With `-confirm=sandbox`, it runs the package's own
functions with generated inputs in a sandbox. The sandbox has no network and no writes outside a
temporary directory. `-search` also searches every function for inputs that make it panic.
`-tests` writes a regression test for each confirmed panic.

## A policy for CI [#a-policy-for-ci]

`marmot verify -write-policy` records what each function proves in `.marmot/verify.json`. Commit the
file. A later run fails (exit 1) when a function proves less, leaves more open, or gains an assumption
that the policy does not allow.

## Flags [#flags]

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

| Flag | Meaning |
| --- | --- |
| `-color string` | color in human output: auto, always or never (NO_COLOR turns auto off) (default "auto") |
| `-confirm string` | run the package's functions with generated inputs to confirm findings: off, sandbox or effects. sandbox runs them in a sandbox (sandbox-exec on macOS, bwrap on Linux) and skips functions that reach files, processes or the network. effects runs those too, in the sandbox (default "off") |
| `-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) |
| `-latent` | also report latent panics: operations that panic for some inputs of their function (preconditions) |
| `-nocache` | analyze everything again, ignoring cached results |
| `-search` | also search every function for inputs that make it panic (needs -confirm) |
| `-tags string` | comma separated build tags |
| `-tests` | write a regression test for every confirmed panic reachable through the API to zz_marmot_verify_test.go in its package (needs -confirm) |
| `-v` | print timing and cache statistics |
| `-write-policy` | record the counts of every function in .marmot/verify.json, the policy later runs (CI) are checked against |

## Full help [#full-help]

```text title="marmot verify --help"
Analyze every function of the named packages (default: the workspace) for operations that can panic at run time. Examples are index and slice bounds, nil dereferences, division by zero and failed type assertions. Each is proved safe, or reported. A manifest finding is a panic that no guard in the code excludes, shown with the input that triggers it. -latent also lists panics that depend on the inputs of their function. Results are cached per package. Findings are notes for now. With -confirm=sandbox, marmot verify runs the package's own functions with generated inputs to confirm findings. They run in a sandbox with no network and no writes outside a temporary directory. Without -confirm, nothing is run.

Usage:
  marmot verify [packages] [flags]

Examples:
marmot verify ./...
marmot verify -latent ./internal/codec
marmot verify -confirm=sandbox -search ./internal/codec
marmot verify -json .

Flags:
      --color string     color in human output: auto, always or never (NO_COLOR turns auto off) (default "auto")
      --confirm string   run the package's functions with generated inputs to confirm findings: off, sandbox or effects. sandbox runs them in a sandbox (sandbox-exec on macOS, bwrap on Linux) and skips functions that reach files, processes or the network. effects runs those too, in the sandbox (default "off")
  -h, --help             help for verify
      --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)
      --latent           also report latent panics: operations that panic for some inputs of their function (preconditions)
      --nocache          analyze everything again, ignoring cached results
      --search           also search every function for inputs that make it panic (needs -confirm)
      --tags string      comma separated build tags
      --tests            write a regression test for every confirmed panic reachable through the API to zz_marmot_verify_test.go in its package (needs -confirm)
      --v                print timing and cache statistics
      --write-policy     record the counts of every function in .marmot/verify.json, the policy later runs (CI) are checked against
```