Gwatch
is a lightweight, super-fast and highly configurable auto reloader for your Go applications. It monitors your Go application for changes and automatically recompile and restarts your application, ensuring you see your changes instantly.
This downloads gwatch, compiles and installs the binary in your $GOPATH/bin
directory.
go install github.com/huboh/gwatch/cmd/gwatch@latest
curl -sSL https://raw.githubusercontent.com/huboh/gwatch/main/install.sh | sh
simply run gwatch in the root of your Go application. If the configuration file gwatch.yml
does not exist in the current directory, gwatch will automatically generate one with it's default values.
gwatch
gwatch
uses a YAML configuration file (gwatch.yml) to define its behavior. the config is automatically generated with default value in the current directory where gwatch
is executed.
Here's an example configuration file:
# The root directory of your application
root: ./
# The build command to compile your application
build:
cmd: go build -o ./bin/app main.go
# The command to run your application
run:
bin: ./bin/app
args: []
# The file extensions to watch for changes
exts:
- go
- tmp
- tmpl
- html
# The paths to watch
paths:
- ./
# The wait delay duration before running commands after detecting changes
delay: 100ms
# The output prefix for your app log messages
log_prefix: your-app
# The directories to exclude from watching
exclude:
- .git
- bin
- vendor
- testdata
# Watch files recursively
recursive: true
- nice cli
- super-fast
- customizable log message prefix
- customizable build and run commands along with other configs
- gwatch will auto restart itself if it detect changes to it's config file
contributions are welcomed! Please fork the repository and submit pull requests. A typical workflow is:
- Fork the repository. see here for tips.
- Create your feature branch.
- Add tests for your change.
- Run
go test
. If your tests pass, return to the step 3. - Implement the change and ensure the steps from the previous step pass.
- Add, commit and push your changes.
- Submit a pull request.
This project is licensed under the BSD-3-Clause License - see the LICENSE file for details.