Go source tree watcher

I would like to replace goimports with a daemon that watches for filesystem changes and a client that queries the daemon to implement behavior like the current goimports. I believe this would be faster than the current implementation of goimports, which takes around 2s to execute on my machine. Does something like this already exist?

https://golanglibs.com/category/auto-rebuild

Many of these are configurable to do whatever you want when files change.

Hey @alexflint,

If you are just looking for a filesystem watcher/event notifier, I suggest checking out the following:

fsnotify: https://github.com/fsnotify/fsnotify - great filesystem notifications library.
watcher: https://github.com/radovskyb/watcher - similar as fsnotify, but uses polling instead of using direct filesystem events, so depends how you want to go about things.

Unless you need to watch folders recursively, filter specific events or prefer polling, fsnotify is probably the way to go.

Edit: I just realized you also asked if something already exists, so probably best to check out the link @nathankerr posted above.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.