aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2020-03-11Correct macOS >= 10.13, Go >= 1.10 CoreFoundation pointer type errorsupdate-to-build-against-go1.14Teddy Wing
When building the project on macOS 10.15 with Go 1.13, I ended up with the following errors: # github.com/keybase/go-notifier ./corefoundation.go:25:9: cannot convert nil to type _Ctype_CFTypeRef ./corefoundation.go:34:3: cannot use nil as type _Ctype_CFDataRef in return argument ./corefoundation.go:40:26: cannot use nil as type _Ctype_CFAllocatorRef in argument to _Cfunc_CFDataCreate ./corefoundation.go:41:12: cannot convert nil to type _Ctype_CFDataRef ./corefoundation.go:42:3: cannot use nil as type _Ctype_CFDataRef in return argument ./corefoundation.go:66:47: cannot use nil as type _Ctype_CFAllocatorRef in assignment ./corefoundation.go:67:12: cannot convert nil to type _Ctype_CFDictionaryRef ./corefoundation.go:68:3: cannot use nil as type _Ctype_CFDictionaryRef in return argument ./corefoundation.go:79:59: cannot convert &(*_cgoIndex1)[0] (type *_Ctype_CFTypeRef) to type *unsafe.Pointer ./corefoundation.go:79:88: cannot convert &(*_cgoIndex2)[0] (type *_Ctype_CFTypeRef) to type *unsafe.Pointer ./corefoundation.go:92:3: cannot use nil as type _Ctype_CFStringRef in return argument ./corefoundation.go:95:3: cannot use nil as type _Ctype_CFStringRef in return argument ./corefoundation.go:103:34: cannot use nil as type _Ctype_CFAllocatorRef in argument to _Cfunc_CFStringCreateWithBytes ./corefoundation.go:138:39: cannot use nil as type _Ctype_CFAllocatorRef in assignment ./corefoundation.go:146:69: cannot convert &(*_cgoIndex2)[0] (type *_Ctype_CFTypeRef) to type *unsafe.Pointer ./corefoundation.go:157:4: cannot use nil as type _Ctype_CFArrayRef in return argument ./corefoundation.go:178:4: cannot use nil as type _Ctype_CFDictionaryRef in return argument ./corefoundation.go:190:5: cannot use nil as type _Ctype_CFDictionaryRef in return argument ./corefoundation.go:197:5: cannot use nil as type _Ctype_CFDictionaryRef in return argument ./corefoundation.go:204:5: cannot use nil as type _Ctype_CFDictionaryRef in return argument ./corefoundation.go:211:4: cannot use nil as type _Ctype_CFDictionaryRef in return argument ./corefoundation.go:218:3: cannot use nil as type _Ctype_CFDictionaryRef in return argument ./notifier_darwin.go:57:38: cannot use nil as type _Ctype_CFStringRef in assignment ./notifier_darwin.go:58:3: cannot use nil as type _Ctype_CFStringRef in assignment Found similar errors reported on the 'fsevents' project: https://github.com/fsnotify/fsevents/issues/33 , https://github.com/golang/go/issues/23317 It turns out that Cgo handles CoreFoundation types differently starting in Go 1.10: > Cgo now translates some C types that would normally map to a pointer > type in Go, to a uintptr instead. These types include the CFTypeRef > hierarchy in Darwin's CoreFoundation framework and the jobject > hierarchy in Java's JNI interface. > > These types must be uintptr on the Go side because they would > otherwise confuse the Go garbage collector; they are sometimes not > really pointers but data structures encoded in a pointer-sized > integer. Pointers to Go memory must not be stored in these uintptr > values. > > Because of this change, values of the affected types need to be > zero-initialized with the constant 0 instead of the constant nil. https://tip.golang.org/doc/go1.10#cgo For the "cannot convert" errors, use xlab's (https://github.com/xlab) suggestion: > The workaround is to pass it as ptr := > (*unsafe.Pointer)(unsafe.Pointer(arg)) which looks strange but works. https://github.com/golang/go/issues/13830#issuecomment-169139332
2020-03-11Fix `-sectcreate` LDFLAGS error when building on Go >= 1.10Teddy Wing
I was trying to build the project and ended up with this error: $ go get go build github.com/keybase/go-notifier: invalid flag in #cgo LDFLAGS: -sectcreate Found this issue https://github.com/golang/go/issues/23937 related to Go 1.10 that describes compiler flags as needing to be whitelisted for security. > Options specified by cgo using #cgo CFLAGS and the like are now > checked against a whitelist of permitted options. This closes a > security hole in which a downloaded package uses compiler options like > -fplugin to run arbitrary code on the machine where it is being built. > This can cause a build error such as invalid flag in #cgo CFLAGS. https://tip.golang.org/doc/go1.10#cgo https://github.com/golang/go/wiki/InvalidFlag The `-sectcreate` flag is included in the whitelist: re(`-Wl,-sectcreate,([^,@\-][^,]+),([^,@\-][^,]+),([^,@\-][^,]+)`), https://github.com/golang/go/commit/eef2fd28ca7023be3a3f1c62039c2643bffac948#diff-4edde0d5efc092a14e579fd0de312bdeR149 However, the format is different from before. The linker flag arguments must now be comma-separated, and prefixed with `-Wl,`. Fixes #3.
2016-05-19Updating docsHEADmasterGabriel Handford
2016-05-19Fix actions and response for darwinGabriel Handford
2016-05-17Merge pull request #1 from keybase/comment-fixMaxwell Krohn
comment fix
2016-05-17Merge pull request #2 from keybase/stub-for-mobileMaxwell Krohn
add a stub for mobile (and others)
2016-05-16Write to stdout instead of using NSLogGabriel Handford
2016-05-16Specify default timeoutGabriel Handford
2016-05-16add a stub for mobile (and others)Maxwell Krohn
2016-05-16comment fixMaxwell Krohn
2016-05-11Alert style notifications (for OS X)Gabriel Handford
- Embeds Info.plist with alert style default (in script) - Includes timeout - Outputs action
2016-05-11Adding actionsGabriel Handford
2016-05-06Fix windowsGabriel Handford
2016-05-06ImportingGabriel Handford