Over the past handful of years, I have used Go as the heavy lifter in many projects. It is, by far, my favorite language to work with.

One reason that it receives my praise is its ability to compile to practically any target with ease. No longer do I have to set up funky, fragile cross-compilers, nor do I have to fight with linkers and minor revisions of dynamic libraries. Further, Go has an impressive ecosystem of high-quality open source packages — there are libraries to do practically anything you could ever want.

These traits make Go an ideal tool for building cross-platform projects that necessitate native performance and functionality.

This article is not intended to be a tutorial. Rather, it hopes to present a high-level picture of the possibilities that Go provides.


One Source, Many Targets

Go’s first-class compiler — gobuild — supports a wide variety of compilation targets. With a single, simple command, you can compile your source down into a macOS binary. With another, that same source can be compiled to an ARMv6 binary for Linux. And with yet another, that same source can be compiled to a WebAssembly binary for execution by any modern web browser or JavaScript engine.

Go also provides a first-class tool called gobind to creating bindings between a single Go source and a variety of other languages. This allows for a single, unified Go source to be consumed — for example, as both a Swift Framework by an iOS application and as a Java package by an Android application.

#android #golang #mobile #programming #software-development #react native

How to Build Native, Cross-Platform Apps With Golang
11.10 GEEK