Pattern: Invalid use of cgo
Issue: -
This rule checks for types that may not be passed to cgo
calls.
Example of incorrect code:
import "C"
import "unsafe"
func CgoTests() {
var c chan bool
C.f(*(*unsafe.Pointer)(unsafe.Pointer(&c))) // embedded pointer
C.f(unsafe.Pointer(&c)) // embedded pointer
}
Example of correct code:
import "C"
import "unsafe"
func CgoTests() {
var i int
C.f(*(*unsafe.Pointer)(unsafe.Pointer(&i)))
C.f(unsafe.Pointer(&i))
}