Go is portable, until it isn't
51–60 of 138 posts
Re: Go is portable, until it isn't
#52Once you use CGO, portability is gone. Your binary is no longer staticly compiled. This can happen subtley without you knowing it. If you use a function in the standard library that happens to call into a CGO function, you are no longer static. This happens with things like os.UserHomeDir or some networking things like DNS lookups. You can "force" go to do static compiling by disabling CGO, but that means you can't u…
https://til.andrew-quinn.me/posts/you-don-t-need-cgo-to-use-...
Re: Go is portable, until it isn't
#53It is a bit cursed, but works pretty well. I'm using it in my hardware-backed KMIP server to interface with PKCS11.
Re: Go is portable, until it isn't
#54The point one needs to touch APIs that only exists on the target system, the fun starts, regardless of the programming language.
Go, Zig, whatever.
Re: Go is portable, until it isn't
#55And a set of people rediscovered why cross compiling only works up to certain extent, regardless of the marketing on the tin. The point one needs to touch APIs that only exists on the target system, the fun starts, regardless of the programming language. Go, Zig, whatever.
Re: Go is portable, until it isn't
#56And a set of people rediscovered why cross compiling only works up to certain extent, regardless of the marketing on the tin. The point one needs to touch APIs that only exists on the target system, the fun starts, regardless of the programming language. Go, Zig, whatever.
You're thinking of cross platform codebases. There's nothing about cross compilation that stops the toolchain from knowing what APIs are present & not present on a target system.
Cross platform goes beyond in regards to UI, direction locations, user interactions,...
Yeah, if you happen to have systemd Linux libraries on macOS to facilitate cross compilation into a compatible GNU/Linux system than it works, that is how embedded development has worked for ages.
What doesn't work is pretending that isn't something to care about.
Re: Go is portable, until it isn't
#57Re: Go is portable, until it isn't
#58That said, in my personal experience, the most portable programs tend to be written in either Perl or Shell. The former has a crap-ton of portability documentation and design influence, and the latter is designed to work from 40 year old machines up to today's. You can learn a lot by studying old things.
Re: Go is portable, until it isn't
#59If your production doesn't have any weird PAM or DNS then you can indeed just cross-compile everything and it works
Re: Go is portable, until it isn't
#60Thanks.