⏱️

How I do watch modes in dev

Created
Oct 22, 2021 8:02 PM
Tags
computingdev productivitygolang

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.

Reflex

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.

How

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

run:
	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

Demo

image