When developing go web apps we need to recompile and re-serve the application to view the changes we made. This process of making changes, stop the app from running, recompile and run again can be quite annoying.
We need a tool that serves the app, notices our source code changing, automatically recompiles it, stops the previous build from being served to finally serve the new build.
CRUN - continuously Compile and Run - does exactly that. It's a go CLI application. With one command all .go files from the current directory are being watched.
Similar tools already exist but I wanted something super simple to use with some tests.
Use
// Change to directory with your app go source code
cd /path/to/my/app
// Start compiling and running app
crun
You can pass additional arguments to the binary.
// additional arguments after `--` are passed to the binary
crun -- --port=:3000
Install
Go get the package to install
go get github.com/toonketels/crun