rjeczalik / notify

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

use C.kCFAllocatorDefault instead of refZero #162

Closed nonsense closed 6 years ago

nonsense commented 6 years ago

This PR is removing refZero and using C.kCFAllocatorDefault instead, which according to https://github.com/golang/text/commit/572a2b141f625f4360cf42a41a43622067e0510b and https://developer.apple.com/documentation/corefoundation/kcfallocatordefault is defined as NULL.

Current version does not compile under go version go1.10.4 darwin/amd64 and throws:

vendor/github.com/rjeczalik/notify/watcher_fsevents_cgo.go:51: cannot use refZero (type *_Ctype_struct___CFAllocator) as type _Ctype_CFAllocatorRef in argument to func literal
vendor/github.com/rjeczalik/notify/watcher_fsevents_cgo.go:169: cannot use refZero (type *_Ctype_struct___CFAllocator) as type _Ctype_CFAllocatorRef in argument to func literal
vendor/github.com/rjeczalik/notify/watcher_fsevents_cgo.go:170: cannot use refZero (type *_Ctype_struct___CFAllocator) as type _Ctype_CFAllocatorRef in argument to func literal

See: https://travis-ci.org/ethereum/go-ethereum/jobs/421003255#L164

imsodin commented 6 years ago

Did you check if it works with Go1.11?

nonsense commented 6 years ago

@imsodin yes, I checked, and this PR works with Go1.11 and Go1.10.4.

Actually current master (https://github.com/rjeczalik/notify/commit/4e54e7fd043e865c50bda93359fb78813a8d165b) works fine with Go1.11, however it doesn't work with Go1.10.4.

rjeczalik commented 6 years ago

Thanks @nonsense for the PR! I did know about C.kCFAllocatorDefault.