Cgo
cgo is Go’s interoperability facility for calling C code and integrating C functions, data, and libraries into Go programs.
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.
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.
Related concepts
- Cuses · C is a general-purpose procedural programming language that provides low-level control over memory and system operations.
- C++uses · C++ is a statically typed, general-purpose programming language that supports procedural, object-oriented, generic, and low-level systems programming.
- Gouses · Go is a statically typed, compiled, general-purpose programming language with garbage collection and built-in support for concurrency.
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.

