Used to build and restart a Go project when it crashes or some watched file changes
Aimed to be used in development only.
go get -u github.com/maxcnunes/gaper/cmd/gaper
See Releases for detailed history changes.
NAME: gaper - Used to build and restart a Go project when it crashes or some watched file changes USAGE: gaper [global options] command [command options] [arguments...] VERSION: version COMMANDS: help, h Shows a list of commands or help for one command GLOBAL OPTIONS: --bin-name value name for the binary built by gaper for the executed program (default current directory name) --build-path value path to the program source code (default: ".") --build-args value arguments used on building the program --program-args value arguments used on executing the program --verbose turns on the verbose messages from gaper --disable-default-ignore turns off default ignore for hidden files and folders, "*_test.go" files, and vendor folder --watch value, -w value list of folders or files to watch for changes --ignore value, -i value list of folders or files to ignore for changes --poll-interval value, -p value how often in milliseconds to poll watched files for changes (default: 500) --extensions value, -e value a comma-delimited list of file extensions to watch for changes (default: "go") --no-restart-on value, -n value don't automatically restart the supervised program if it ends: if "error", an exit code of 0 will still restart. if "exit", no restart regardless of exit code. if "success", no restart only if exit code is 0. --help, -h show help --version, -v print the version
Watch and Ignore paths
For those options Gaper supports static paths (e.g.
seed.go) or glob paths (e.g.
On using a path to a directory please add a
/ at the end (e.g.
build/) to make sure Gaper won't include other matches that starts with that same value (e.g.
Default ignore settings
Since in most projects there is no need to watch changes of:
- hidden files and folders
- test files (
- vendor folder
Gaper by default ignores those cases already. Although, if you need Gaper to watch those files anyway it is possible to disable this setting with
Currently Gaper uses polling to watch file changes. We have plans to support fs events though in a near future.
Using all defaults provided by Gaper:
Ignore watch over all test files:
no need for this if you have not disabled the default ignore settings
See the Contributing guide for steps on how to contribute to this project.
Basically, Gaper is a mixing of those projects above. It started from gin code base and I rewrote it aiming to get
something similar to node-supervisor (but simpler). A big thanks for those projects and for the people behind it!
How is Gaper different of Gin
The main difference is that Gaper removes a layer of complexity from Gin which has a proxy running on top of the executed server. It allows to postpone a build and reload the server when the first call hits it. With Gaper we don't care about that feature, it just restarts your server whenever a change is made.