Portability: Rust - Go Comparison

,

<off-topic>

Right now the support for each is:

Go:

  • android arm
  • darwin 386
  • darwin amd64
  • darwin arm
  • darwin arm64
  • dragonfly amd64
  • freebsd 386
  • freebsd amd64
  • freebsd arm
  • linux 386
  • linux amd64
  • linux arm
  • linux arm64
  • linux ppc64
  • linux ppc64le
  • linux mips
  • linux mipsle
  • linux mips64
  • linux mips64le
  • linux s390x
  • netbsd 386
  • netbsd amd64
  • netbsd arm
  • openbsd 386
  • openbsd amd64
  • openbsd arm
  • plan9 386
  • plan9 amd64
  • solaris amd64
  • windows 386
  • windows amd64

Rust’s supported platforms is too huge, see it in the docs instead:
https://forge.rust-lang.org/platform-support.html

Rust has a few tiers of support, but in essence tier 1 has active tests on every single commit as well as full compiler support (I.E. the compiler itself can run on it as well). Tier 2 has full support but automated tests aren’t always run on every commit but are tested on released and candidates and so forth, the compiler/cargo will run on some of these, but not all. Just tier 1 and tier 2 is significantly larger than Go’s supported platforms of just its output code (and go’s compiler won’t run on everything at all). Then you start getting into tier 2.5 and tier 3, which are not build or tested automatically but are available, generally they are very niche-specific systems like windows xp and older and nips and cortex and so forth. Rust can even compile to GPU’s and webassembly natively as part of Tier 2.

Go by it’s very design will never be able to run on the amount of hardware that Rust can. It’s design and GC mean that the language is not powerful enough to do so without making limitations to the language that will break just about every library in the ecosystem (like getting rid of the GC or memory allocation when compiling to embedded systems). Rust is designed to even have a tiered standard lib so you can get some guarantees even on highly restricted microcontrollers, or you can rip it completely out if you so wish and compile a binary that is mere kilobytes in size.

And yes, Rust can cross-compile with ease, generally as simple as cargo build --target=blah-bleep-blorp. Linking is handled by LLVM so sometimes you need a special linker for things like windows when wanting to bind to MSVC libraries or so instead of the open ones (although the cross tool automates most of that with docker images), but in general you can just use cargo to grab the proper platform runtime that you want and compile using it and then of course you have the horror that is Apple, you ‘can’ cross-compile to apple systems but it’s a little (well, more than a little) slice of horror, as cross-compiling to Apple products always is. ^.^;

I’ve PR’d to a few golang projects so far but I just can’t get around how wordy and verbose and unreadable the language is, so I’ve not really put through effort to learn it extensively, and rust has it’s rough edges in syntax but it is fairly comprehensive and significantly more readable (until you start getting into some hairy lifetime declarations, but those are rare and they’ve saved my butt so many times unlike Go that lets you just Interface{} pass everything all horribly).

8 Likes