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
Closed

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

bep opened this issue Jan 3, 2018 · 6 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@bep
Copy link
Contributor

bep 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
@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
@mvdan mvdan added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jan 3, 2018
@odeke-em
Copy link
Member

odeke-em commented Jan 3, 2018

/cc @mdempsky @randall77

@ianlancetaylor
Copy link
Contributor

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

@Yamilquery
Copy link

Yamilquery 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
Copy link
Contributor

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
Copy link

Yamilquery 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
Copy link
Contributor

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

@golang golang locked and limited conversation to collaborators Nov 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

7 participants