bugst / go-serial

A cross-platform serial library for go-lang.
BSD 3-Clause "New" or "Revised" License
620 stars 189 forks source link

Fix 'darwin' build with latest releases of golang #51

Closed cmaglie closed 5 years ago

cmaglie commented 5 years ago

go1.8.7, go1.9.4 and go1.10+ introduced a security feature that do not allow arbitrary CGO flags, in particular -fconstant-cfstrings. This PR fixes this by removing this build flag.

Moreover go1.10+ introduces some changes in how CFRefs (and derivative pointers) are mapped in golang. This is also fixed in this PR by duplicating usb_darwin.go in two files with corresponding build tags:

The implementation for go1.9 and earlier will be "freezed" and kept only for compatibility, all the bugfix and improvements will be on usb_darwin.go.

Fix #50 @facchinm @gibranv @borud