rjeczalik / notify

File system event notification library on steroids.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot build my code on FreeBSD

probonopd opened this issue · comments

Getting

./inotify.go:41:34: undefined: "github.com/rjeczalik/notify".InCloseWrite
./inotify.go:41:55: undefined: "github.com/rjeczalik/notify".InMovedTo
./inotify.go:42:3: undefined: "github.com/rjeczalik/notify".InMovedFrom
./inotify.go:42:23: undefined: "github.com/rjeczalik/notify".InDelete
./inotify.go:43:3: undefined: "github.com/rjeczalik/notify".InDeleteSelf
./inotify.go:51:8: undefined: "github.com/rjeczalik/notify".InDeleteSelf

The code I am using compiles and seems to work on Linux.
Am I doing it wrong, is there a more cross-OS portable way of doing things?

Those are inotify specific events, and BSDs have kqueue not inotify. For cross-compatibility you need to use the common events (https://github.com/rjeczalik/notify/blob/master/event.go#L22) or define platform specific events behind build flags.

Thank you very much for the clarification @imsodin. Will need to rewrite.