<jack>

If it’s too hard you’re doing it wrong.

React2FS - React to File System Changes

Posted at — Oct 4, 2014

React2FS is a standalone, cross-platform, file system watcher written in Go. React2FS’s primary use is as development tool to automatically run tests or rebuild a package when a source file changes.

For example, from a Go package directory simply run react2fs go test and your tests will automatically be run whenever any file is changed.

jack@edi:~/dev/go/src/github.com/jackc/pgx$ react2fs go test
PASS
ok    github.com/jackc/pgx  0.499s
2014/10/04 11:41:04 "./doc.go": CHMOD
PASS
ok    github.com/jackc/pgx  0.443s
2014/10/04 11:47:01 "./hstore.go": CHMOD
PASS
ok    github.com/jackc/pgx  0.499s

React2FS can watch multiple directories and can include or exclude files based on a regular expression. For example, to only run tests when a .go file changes and ignore other file system events:

jack@edi:~/dev/go/src/github.com/jackc/pgx$ react2fs -include="\.go$" go test
PASS
ok    github.com/jackc/pgx  0.480s
2014/10/04 11:48:23 "./conn.go": CHMOD
PASS
ok    github.com/jackc/pgx  0.487s

Check it out at Github.