Best Practices in cgo Part I: Structs

One of the libraries that makes Go so powerful is cgo, a set of bindings for calling C code from Go. This is called a Foreign Function Interface (or FFI) and despite the versatility it adds to Go, it can be a tricky library to use. To help ease new users through some of the trickier aspects of cgo, here are some general best practices. Structs Handing C structs is one of the most common issues with cgo code.