Watcher is a Go live reload or retest program for Linux.
Watcher monitors the files in a directory and all its subfolders. If a write or delete event occurs on any file, the Go program or the tests are reloaded.
If a .gitignore file is present, Watcher will use it to exclude files from monitoring. Use .watcherignore file to add patterns to ignore that can not be added to .gitignore.
Watcher also accepts to pass arguments to the program via the args flag.
Arguments must be surrounded with quotes.
-dir pathfolder to watch (default current folder)-run progprogram to run (default empty)-args "arguments..."pass arguments to the program (default empty). This has no effect with -test.-testlaunch tests instead of the program-verbosetestlaunch tests with verbosity-helpview the command usage
Examples
Watch the current folder (default) and run the program in ./cmd/server with some arguments (note the quotes)
watcher -run ./cmd/server/ -args "-name John -age 24"Watch folder ./pkg and run the program in ./cmd/server
watcher -run ./cmd/server -dir ./pkgWatch current folder and retest
watcher -testSame thing but test with verbosity
watcher -verbosetestWatch current folder and retest all subfolders
watcher -test -run ./...Example of a .watcherignore file
$ cat .watcherignore
.watcherignore
.git
cmd/client
*.md
*.yml
*.sh
*.mod
*.sum
Makefile