我正在运行以下命令来安装一个用 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
Go 版本:Go 版本 go1.11.4 达尔文/amd64
我也遇到了这个问题。 对我来说,问题是我使用的Geth vs Go版本。 您可能需要将 geth 升级到当前版本或至少版本 geth v1.8.16
https://github.com/ethereum/go-ethereum/issues/17751
不过,这对我来说不是一个选择,所以我找到了第二个解决方案。 在这些代码行中,您将看到 nils,您不需要切换所有代码,但是如果您将指定的代码切换到 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)