6 ms·
Golang Automatic Reloads
- samnardoni 13y agoOr rerun by skelterjohn http://github.com/skelterjohn/rerun http://github.com/skelterjohn/rerun
- masklinn 13y agoThat's more of an automatic restart (kill and start the process again) than an automatic reload (update code within the running system). And surely there are non-go-specific tools which can already do that, aren't there?
- lpmay 13y agoYup, such tools exist. I've used peat before for stuff like this: https://github.com/sjl/peat https://github.com/sjl/peat
- rorrr2 13y agoOn Windows you can use something like this http://www.nodesoft.com/foldermonitor http://www.nodesoft.com/foldermonitor (freeware)
- mischanix 13y agoGo also provides a syscall for ReadDirectoryChanges, and one really nice Go library that uses inotify/ReadDirectoryChanges is https://github.com/howeyc/fsnotify https://github.com/howeyc/fsnotify
- Sirupsen 13y agoSIGKILL seems a little aggressive for a controlled process restart.
- deafbybeheading 13y agoNot to mention the program sigkills itself before it attempts to `exit 0`...
- alexedwards 13y agoGenuine question - can a process kill itself? The kill of go-reload was to make sure background processes get cleaned up, but I suspect one of the kill or exit in the close function is superfluous.
- justin66 13y ago> Genuine question - can a process kill itself? Sure. Send the signal, the signal handler - custom or default - handles it. This works whether the signal comes from another process or its own process.
- dinduks 13y agoCEL is a similar and more generic script: it can do that for any program and works on Linux and Mac. https://github.com/Dinduks/change-execute-loop https://github.com/Dinduks/change-execute-loop