我正在运行以下命令来安装用于go for Solidity编写的单元测试的软件包。
go install ./cmd/abigen
但是我收到这些错误:
# github.com/ethereum/go-ethereum/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
转到版本:转到go1.11.4版本darwin / amd64
答案 0 :(得分:0)
我也遇到了这个问题。对我来说,问题是我使用的Geth vs Go版本。您可能需要将geth升级到当前版本或至少将geth v1.8.16版本升级
https://github.com/ethereum/go-ethereum/issues/17751
那对我来说不是一个选择,所以我找到了第二个解决方案。在这些代码行中,您将看到nil,您不需要切换所有的nil,但是如果将指定的n / c切换为C.kCFAllocatorDefault,它应该可以工作。实际替换的示例如下。
51
var source = C.CFRunLoopSourceCreate(C.kCFAllocatorDefault, 0, &C.CFRunLoopSourceContext{
perform: (C.CFRunLoopPerformCallBack)(C.gosource),
})
165
p := C.CFStringCreateWithCStringNoCopy(C.kCFAllocatorDefault, C.CString(s.path), C.kCFStringEncodingUTF8, C.kCFAllocatorDefault)
166
path := C.CFArrayCreate(C.kCFAllocatorDefault, (*unsafe.Pointer)(unsafe.Pointer(&p)), 1, nil)