marmot fix
Apply the suggested fixes of build errors and check findings.

Build, apply every machine applicable fix (missing imports, unused imports and variables, := with no new variables, ...), and build again until no fix applies. -all adds fixes that may be incorrect, such as typo corrections.
marmot fix [packages] [flags]Examples
marmot fix
marmot fix -code M0005 ./cmd/app
marmot fix -allmarmot fix applies the machine applicable fixes of build errors, then those of the fmt and
modernize checks. After each round it type checks the changed packages and undoes the fixes
of any package that no longer builds; -test also requires their tests to pass.
-code M0004,M0005limits it to those build error codes.-alladds fixes that may be incorrect, such as typo corrections and vet or lint suggestions.-only fmt,modernizeapplies only those check fixes.-diffprints the patches and changes nothing.-upgrade go1.Nraises the module's go version first.
marmot fix -diff -only modernizeEvery fix carries an applicability: machine-applicable (safe to apply unseen),
maybe-incorrect (likely, check it) or has-placeholders (never applied as is). Plain
marmot fix applies only the first kind.
Flags
Flags take one dash or two: -release and --release are the same.
| Flag | Meaning |
|---|---|
-all | also apply fixes that may be incorrect (typo corrections); check the result |
-code string | only apply fixes for these comma separated codes, for example M0004,M0005 |
-color string | color in human output: auto, always or never (NO_COLOR turns auto off) (default "auto") |
-diff | print the check fixes as patches, change nothing |
-json | machine readable output: JSON Lines on stderr (also $MARMOT_OUTPUT=json, and the default under coding agents) |
-only string | apply only the fixes of these checks (fmt, modernize, vet, lint, exhaustive), not the build errors |
-tags string | comma separated build tags |
-test | keep a check fix only if the tests of its package still pass |
-upgrade string | raise the go version of the modules to go1.N and apply the modernizers it unlocks |
Full help
Build, apply every machine applicable fix (missing imports, unused imports and variables, := with no new variables, ...), and build again until no fix applies. -all adds fixes that may be incorrect, such as typo corrections.
Usage:
marmot fix [packages] [flags]
Examples:
marmot fix
marmot fix -code M0005 ./cmd/app
marmot fix -all
Flags:
--all also apply fixes that may be incorrect (typo corrections); check the result
--code string only apply fixes for these comma separated codes, for example M0004,M0005
--color string color in human output: auto, always or never (NO_COLOR turns auto off) (default "auto")
--diff print the check fixes as patches, change nothing
-h, --help help for fix
--json machine readable output: JSON Lines on stderr (also $MARMOT_OUTPUT=json, and the default under coding agents)
--only string apply only the fixes of these checks (fmt, modernize, vet, lint, exhaustive), not the build errors
--tags string comma separated build tags
--test keep a check fix only if the tests of its package still pass
--upgrade string raise the go version of the modules to go1.N and apply the modernizers it unlocks