Is there a way to have go test run whenever a project's files are modified?
Perhaps there is a good general solution to run a command when files in a path are modified that could be used for this use?
You can use inotifywait for that. Example watching some dir and executing go test on close while having data written:
inotifywait -e close_write <dir> | while read file; do go test; done
Or you write your own tool in go utilizing the howeyc/fsnotify package: Similar example application.
There's also rerun, written in ruby:
rerun go test
Above command will watch the current directory for changes and run go test when a change occurs.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With