Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/compile: cannot convert nil to type _Ctype on macOS High Sierra #23317

Closed
bep opened this issue Jan 3, 2018 · 6 comments

Comments

Projects
None yet
6 participants
@bep
Copy link
Contributor

commented Jan 3, 2018

See fsnotify/fsevents#33

Note that I'm not the original reporter, but I thought I should raise this just in case.

According to the reporter:

ProductName:	Mac OS X
ProductVersion:	10.13
BuildVersion:	17A365
Go Go 1.10 beta1

-> % GOROOT=/usr/local/go110 /usr/local/go110/bin/go test
# github.com/fsnotify/fsevents
./wrap.go:38: constant 36893488147419103231 overflows uint64
./wrap.go:80: cannot use f (type FSEventStreamRef) as type _Ctype_ConstFSEventStreamRef in argument to func literal
./wrap.go:85: cannot use f (type FSEventStreamRef) as type _Ctype_ConstFSEventStreamRef in argument to func literal
./wrap.go:91: cannot use f (type FSEventStreamRef) as type _Ctype_ConstFSEventStreamRef in argument to func literal
./wrap.go:97: cannot use f (type FSEventStreamRef) as type _Ctype_ConstFSEventStreamRef in argument to func literal
./wrap.go:112: cannot convert nil to type _Ctype_CFUUIDRef
./wrap.go:115: cannot use nil as type _Ctype_CFAllocatorRef in argument to func literal
./wrap.go:119: cannot convert nil to type _Ctype_CFStringRef
./wrap.go:122: cannot use nil as type _Ctype_CFAllocatorRef in argument to func literal
./wrap.go:175: cannot use nil as type _Ctype_CFAllocatorRef in argument to _Cfunc_CFStringCreateWithCString
./wrap.go:175: too many errors

@bep bep referenced this issue Jan 3, 2018

Closed

Go 1.10 support #33

@mvdan mvdan changed the title cannot convert nil to type _Ctype on macOS High Sierra cmd/compile: cannot convert nil to type _Ctype on macOS High Sierra Jan 3, 2018

@mvdan mvdan added this to the Go1.10 milestone Jan 3, 2018

@odeke-em

This comment has been minimized.

Copy link
Member

commented Jan 3, 2018

@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

commented Jan 3, 2018

This is unfortunate but intentional. See https://tip.golang.org/doc/go1.10#cgo. Closing. Please comment if you disagree.

@Yamilquery

This comment has been minimized.

Copy link

commented Nov 7, 2018

So what is the solution to get running Go in Mac OS X Mojave?

➜  cells git:(master) go version
go version go1.11.2 darwin/amd64
➜  cells git:(master) go test
# github.com/pydio/cells/vendor/github.com/rjeczalik/notify
vendor/github.com/rjeczalik/notify/watcher_fsevents_cgo.go:51:216: cannot use nil as type _Ctype_CFAllocatorRef in argument to func literal
vendor/github.com/rjeczalik/notify/watcher_fsevents_cgo.go:165:47: cannot use nil as type _Ctype_CFAllocatorRef in argument to _Cfunc_CFStringCreateWithCStringNoCopy
vendor/github.com/rjeczalik/notify/watcher_fsevents_cgo.go:166:225: cannot use nil as type _Ctype_CFAllocatorRef in argument to func literal
@randall77

This comment has been minimized.

Copy link
Contributor

commented Nov 7, 2018

You need to convert nil to 0 in the affected places.
There's a gofix module which should do the work for you.

go tool fix -r cftype <pkg>
@Yamilquery

This comment has been minimized.

Copy link

commented Nov 7, 2018

Thank you for your answer, but it doesn't work for me. The issue here occurs even if I exec the following:

➜  cells git:(master) go tool fix -r cftype ./
warning: no cgo types: exit status 1
warning: no cgo types: exit status 1
warning: no cgo types: exit status 1
warning: no cgo types: exit status 1
➜  cells git:(master) go test
# github.com/pydio/cells/vendor/github.com/rjeczalik/notify
vendor/github.com/rjeczalik/notify/watcher_fsevents_cgo.go:51:216: cannot use nil as type _Ctype_CFAllocatorRef in argument to func literal
vendor/github.com/rjeczalik/notify/watcher_fsevents_cgo.go:165:47: cannot use nil as type _Ctype_CFAllocatorRef in argument to _Cfunc_CFStringCreateWithCStringNoCopy
vendor/github.com/rjeczalik/notify/watcher_fsevents_cgo.go:166:225: cannot use nil as type _Ctype_CFAllocatorRef in argument to func literal
➜  cells git:(master)

Issue related :
pydio/cells#29

@randall77

This comment has been minimized.

Copy link
Contributor

commented Nov 7, 2018

Then you will need to fix those 3 lines by hand.
Just replace nil with 0 at the locations reported by those errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.