From 1f977a94aacc2952183ad5603b446562d75b062a Mon Sep 17 00:00:00 2001 From: Sebastian Zagrodzki Date: Sun, 26 Mar 2017 17:44:25 +0200 Subject: [PATCH] Update the comment - there's no way to create a new pointer to struct libusb_device, since the struct is not defined in libusb headers (only name is declared), as such the compiler doesn't know the size of the struct to allocate. --- usb/fakelibusb_test.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/usb/fakelibusb_test.go b/usb/fakelibusb_test.go index ebd042d..c342864 100644 --- a/usb/fakelibusb_test.go +++ b/usb/fakelibusb_test.go @@ -289,7 +289,10 @@ func newFakeLibusb() *fakeLibusb { claims: make(map[*libusbDevice]map[uint8]bool), } for i, d := range fakeDevices { - // TODO(https://golang.org/issue/19487): use new(libusbDevice) after Go 1.9 + // libusb does not export a way to allocate a new libusb_device struct + // without using the full USB stack. Since the fake library uses the + // libusbDevice only as an identifier, use arbitrary numbers pretending + // to be pointers. The contents of these pointers is never accessed. fl.fakeDevices[(*libusbDevice)(unsafe.Pointer(uintptr(i)))] = &fakeDevice{ desc: d, alt: 0,