Added an event "-e modify" to solve issue #9.
Added an event "-e modify" to solve the #9 issue that doesn't work on Ubuntu 14.04 with inotifywait 3.14.
The problem with monitoring both modify and close_wait events is that it seems some text editors trigger both events when a file is saved. So far I've tried, nano, gedit and sublime, and all three editors trigger both events on save.
Even running echo 'hello' >> main.go seems to trigger both events, at least on my machine.
In turn, that unfortunately means that the restart function in the script is called multiple times, unnecessarily, when using those editors.
One solution might be to add some additional logic to the script to ensure that restart is called once for each 'burst' of events (in conjunction with adding the extra -e modify in this PR). But I think both things need to be done at the same time.
Out of interest, what editor / process are you using to modify your main.go file?
I am using VScode to modify Go file. Also, tried with Atom and Sublime, all editors have the same issue.