(Which needed to be old enough that it had old glibc, so someone with 10 year old OS doesn't complain. Linux.)
zig gets around that by using musl, right? or does it use old libc?
So it's not technically possible to compile to all platforms that Go runs on, only the platforms that the trans-compiler supports. And the resulting Go code is not that readable.
https://gitlab.com/cznic/libtcl9.0/-/blob/master/libtcl9_0_l...
https://pkg.go.dev/modernc.org/ccgo/v3
But it still improves cross-compiling, and results in a libc independent static binary, which is nice. And the work done on the trans-compiling is great.
It’s not bad.
It’s a misguided community thing.
Cgo is the correct choice for many domains (ui, gamedev, systems stuff) where you can’t use a network boundary as your “interacts with other languages”.
The language is opinionated; it’s not good at playing with others. It’s good at other things (network services, etc)… but you can and it’s not bad.
…it’s just hard, and people don’t like hard things.
That library (like this) claim “no cgo” when they use ffi is just ridiculous.
This one is particularly egregious in even supporting cgo!
Pure go my ass. You’re invoking c functions. It’s not pure go.
The distinction is in the tool chain; cgo is a better, first party solution.
Purego is an unstable (it is, read the repo!) workaround for people who a) don’t like the word “cgo” or b) dont like having a c tool chain.
…but realistically you have to interop with c code in many domains.
Sure, a pure world is great, but that’s not always possible.
People who don’t like cgo and choose purego are doing it for, mostly, optics (cgo is bad! This isn’t cgo… it’s ffi… totally different) and appear to fail to appreciate the technical distinction more complicated than they imagine, and they are still using c.
If I can I always pick pure Go solutions just for this reason.
So, it simplifies build pipelines, at the cost of being a bit slower in the runtime.
This is also nice to read about the topic: https://dave.cheney.net/2016/01/18/cgo-is-not-go