Recently I have started learning go. It is fun to learn something new, However this time just to make the feedback loop faster, I wrote a small bash script (by collecting fragments from all over the internet) using inotify. Here it is:
The script itself is pretty self explanatory, We run inotifywait in
monitor mode so that it blocks the current process, after that we pipe whatever output comes out of inotifywait which is just the filename to the while loop which doesn’t end because of the previous stream. Now, we just filter it to go source files and execute them.
This can be used with any other programming language too, you just have to change the filter and the execute command.
###Update: I started playing with go web apps recently, and the following script has been helping me with recompile and reload. Hope it helps you guys too:
inotify-tools to get this to work. You can install it on ubuntu by running
sudo apt-get install inotify-tools