I have been developing Digital Carrot with Go Mobile for the last year and it has been a largely positive experience. This article is meant to serve as a repository of everything I’ve learned throughout the process.
Why did I choose Go Mobile?
The short answer is that I really like Go and wanted to use it. The longer answer is that is some combination of the following:
Digital Carrot is a cross platform application, and I wanted something that I could easily compile and run anywhere.
Go has a strong library of system features that I wanted to use to make Digital Carrot customizable and pluggable. Chief among these are Expr (for building expressions) and Goja (for creating JavaScript plugins).
How am I using Go Mobile?
Go mobile is used for all the business logic for Digital Carrot. While I would have loved to use Fyne for the UI, I gave it a try and decided it just isn’t quite mature enough. Instead, I opted to use Flutter with a Go backend
Here is more or less what it looks like:
Flutter calls into Switf/Kotlin using platform channels API calls are binary encoded protobuf messages Native code forwards the raw binary to Go Go decodes the protobuf messages and responds
Go can also call native code via interfaces when it needs to interact with native APIs
... continue reading