🤨 What Random

How I do watch modes in dev

I've recently been developing in certain language ecosystems that do not have standard "watch modes". For the uninitiated, watch mode is akin to restarting the application that you develop every time your source code changes.


Enter reflex.

From the horses mouth:

Reflex is a small tool to watch a directory and rerun a command when certain files change. It's great for automatically running compile/lint/test tasks and for reloading your application when the code changes.


So, if I standardize my run command across my dev env in a Makefile like this:

    go run cmd/server/main.go

Then I can do the following across all my golang repos, and get consistent results:

reflex -s -r '\\.go$' make run


- 1 toast