rjeczalik / notify

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

CFAllocatorRef in Go v1.11 and v1.10.4 #163

Closed shaunnbarron closed 6 years ago

shaunnbarron commented 6 years ago

When compiling with newer versions of Go (v1.11 and v1.10.4) I get the following errors:

vendor/github.com/rjeczalik/notify/watcher_fsevents_cgo.go:51: cannot use nil as type _Ctype_CFAllocatorRef in argument to func literal
vendor/github.com/rjeczalik/notify/watcher_fsevents_cgo.go:169: cannot use nil as type _Ctype_CFAllocatorRef in argument to _Cfunc_CFStringCreateWithCStringNoCopy
vendor/github.com/rjeczalik/notify/watcher_fsevents_cgo.go:170: cannot use nil as type _Ctype_CFAllocatorRef in argument to func literal

Compiles fine with Go v1.10.3. I can fix the problem by replacing the nil arguments with C.kCFAllocatorDefault. I'd put in a PR, but if I'm being honest, I don't know enough about cgo to know why that fixes it. I'm simply following this documentation:

https://developer.apple.com/documentation/corefoundation/1521250-cfallocatorallocate

The allocator to use to allocate the memory. Pass NULL or kCFAllocatorDefault to use the current default allocator.

ppknap commented 6 years ago

Hey @pkgmain !

You may try with the current master branch. This issue probably was solved in #162.

shaunnbarron commented 6 years ago

Okay, thanks. I see it.

Should a release be cut/tagged? Go / Dep will default to the 0.9.0 release:

$ go get github.com/rjeczalik/notify
$ cat go.mod
module github.com/pkmain/modules-test

require (
        github.com/go-chi/chi v3.3.2+incompatible
        github.com/rjeczalik/notify v0.9.0 // indirect
)
rjeczalik commented 6 years ago

@pkgmain I've just tagged 0.9.1, if you still find some issues please reopen this.