33.7 Pure Go Builds: CGO_ENABLED=0
Let’s talk about getting rid of C. I know, it sounds blasphemous, but sometimes you just want a clean, simple, dependency-free Go binary. No linking against libc, no worrying about cross-compilation toolchains, no fuss. That’s where CGO_ENABLED=0 comes in—your ticket to a pure Go build. You see, the Go toolchain is a bit of a split personality. By default, it’s friendly with C. It uses CGo to bridge the gap between Go and the vast, ancient world of C libraries. This is fantastic when you need to talk to a hardware SDK or a battle-tested library like SQLite. But this friendship comes at a cost: your binary is now tied to the C library on the target machine (usually libc), and cross-compiling becomes a nightmare of installing obscure cross-compiler toolchains.