mitranim / gow

Missing watch mode for Go commands. Watch Go files and execute a command like "go run" or "go test"
The Unlicense
772 stars 29 forks source link

fsnotify/fsnotify version #23

Closed vanodevium closed 2 months ago

vanodevium commented 2 years ago

This is example of gow based on fsnotify/fsnotify

Main goals:

We can implement any goal :)

mitranim commented 2 years ago

Thank you for the various suggestions! I'm busy for IRL reasons, so please don't expect a meaningful response this week. Will try to dive in next week. 🙂

mitranim commented 2 years ago

Apologies but I decided that the old code was incompatible with collaborative work. I rewrote gow to make it more modular and maintainable. In addition, there is an internal interface Watcher that allows multiple watch implementations. If you're still interested, it's possible to add a watcher based on fsnotify and make it an option via CLI flags, instead of completely replacing notify.

Additionally, I'm not convinced that fsnotify is relevant. Your PR walks the existing directory structure, snapshotting it on startup, and watches directories and sub-directories. The exact same approach can be used with notify, without swapping to an inefficient polling-based library. This approach should also be opt-in, because it requires a fixed directory structure and may not work with dynamic adding and removal of directories. When "normal" recursive watch fails, we could annotate the error with a hint, suggesting the other approach to the user.

vanodevium commented 2 years ago

Sounds good. I wanna help with your idea for modular gow :)

Lets gow be more elastic :)