marmot watch
Build, run or test again after every change.
Build now and after every change to a .go file, go.mod or go.sum of the module, using the build cache so only what changed is compiled again. With run, the program is stopped and started again; with test, the tests run again. The screen is cleared before each round on a terminal. Watch flags (-interval, -clear) come first; the other flags go to the build.
marmot watch [build|run|test] [packages] [flags]Examples
marmot watch
marmot watch run ./cmd/server -port 8080
marmot watch test -run TestParse ./...marmot watch builds the current package now and again after every change to a .go file,
go.mod or go.sum. marmot watch run ./cmd/server -port 8080 stops the program and starts
the new build after each change; marmot watch test ./... runs the tests again.
The screen is cleared before each round on a terminal (-clear=false keeps the scrollback);
-interval sets how often files are checked. Rebuilds go through the build cache, so only what
changed is compiled again. marmot watch -generate runs marmot generate
before every build.
Flags
Flags take one dash or two: -release and --release are the same.
| Flag | Meaning |
|---|---|
-clear | clear the screen before each build (terminal only) (default true) |
-color string | color in human output: auto, always or never (NO_COLOR turns auto off) (default "auto") |
-generate | run marmot generate (cached) before each build |
-interval string | how often to look for changed files (default "300ms") |
-json | machine readable output: JSON Lines on stderr (also $MARMOT_OUTPUT=json, and the default under coding agents) |
Full help
Build now and after every change to a .go file, go.mod or go.sum of the module, using the build cache so only what changed is compiled again. With run, the program is stopped and started again; with test, the tests run again. The screen is cleared before each round on a terminal. Watch flags (-interval, -clear) come first; the other flags go to the build.
Usage:
marmot watch [build|run|test] [packages] [flags]
Examples:
marmot watch
marmot watch run ./cmd/server -port 8080
marmot watch test -run TestParse ./...
Flags:
--clear clear the screen before each build (terminal only) (default true)
--color string color in human output: auto, always or never (NO_COLOR turns auto off) (default "auto")
--generate run marmot generate (cached) before each build
-h, --help help for watch
--interval string how often to look for changed files (default "300ms")
--json machine readable output: JSON Lines on stderr (also $MARMOT_OUTPUT=json, and the default under coding agents)