liveBook · Manning

Cgo

cgo is Go’s interoperability facility for calling C code and integrating C functions, data, and libraries into Go programs.

How 2 Manning books explain it

Logs and Telemetry

cgo is a Go toolchain facility that enables Go programs to interoperate with C code and libraries.

How it is used
Connects Go-based Fluent Bit plugins to the C core and enables configuration-driven plugin behavior.
How deep it goes
Explains function mapping, memory transfer, shared-object loading, hot reload, and platform-specific compilation.
Examples
Uses input and output plugins, database logic, shared-object builds, Dockerfile relationships, and an output flush callback.
What you can do after
Build Go extensions that Fluent Bit loads as shared objects and update them through hot reload.

Read how Logs and Telemetry explains cgo →

Go in Practice, Second Edition

cgo is Go's interoperability facility for calling C code and linking C and Go sources in one program.

How it is used
Connects Go applications to C libraries when native Go replacements are unavailable or costly to create.
How deep it goes
Demonstrates basic embedded C calls and mentions runtime tuning, while deferring detailed interoperability pitfalls.
Examples
Uses an embedded C fizz_buzz function called from a Go main function.
What you can do after
Apply it via cgo to call C functions and integrate existing C libraries into Go programs.

Read how Go in Practice, Second Edition explains cgo →

Related concepts

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.