rjeczalik / notify

File system event notification library on steroids.
MIT License
900 stars 128 forks source link

Cannot build my code on FreeBSD #189

Closed probonopd closed 4 years ago

probonopd commented 4 years ago

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?

rjeczalik commented 4 years ago

What Linux distro do you use?

On Sat 29. Aug 2020 at 13:08, probonopd notifications@github.com wrote:

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

My code compiles and seems to work on Linux.

Am I doing it wrong?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/rjeczalik/notify/issues/189, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAI3WIL3O3EVCYI7UTXCBR3SDDOTDANCNFSM4QO5ZX6Q .

imsodin commented 4 years ago

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.

probonopd commented 4 years ago

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