Attempts to pass a Go chan, map, func, or slice to C, either directly, or via a pointer, array, or struct is not recommended. This is because the values of these types (apart from zero-value) always contain Go pointers, which is not allowed by the cgo pointer passing rules.
For example:
package a
// void f(void *ptr) {}
import "C"
func fn () {
var c chan bool
C.f(unsafe.Pointer(&c))
}
uses a pointer to a channel, which is not allowed by pointer passing rules.