-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
-
TinyGo
Go compiler for small places. Microcontrollers, WebAssembly (WASM/WASI), and command-line tools. Based on LLVM.
To keep the project simple, I decided to just make an Mac status bar application rather than full-fledged UI application. For this task, conveniently, there's already a popular package caseymrm/menuet. I only have to define my status bar app as below and bind the different functions of lighthttpcli to UI interactions.
Let's start with something light-hearted which most of us might have at least heard about - WebAssembly. I won't go into nitty gritty details of WebAssembly in this post as we all have short attention spans, but basically we just have to write a simple Go script with a main function that will be compiled down to wasm and executed with the help of GoWASM exec script. Read more about Go WebAssembly here.
This part is one that I struggled the most with as the gomobile package is unstable and also lacks documentation and guides (as we all could have guessed that it's rarely used in a practical sense).
Aren't our web assets part of the system as well? So to make it completely Go, we've gotta some how make them part of the Go code. The most obvious choice for that is to turn them into binaries and embed right inside our backend code. This task is relatively simple with a wide range of tools to choose from. For this project, I went with statik, and simply generate the embeddings with this command.
Now it's time for some unveiling and see the system in action 🤩. The complete source code can be found in this repo.
The special part about this code is the machine package that's not a built-in but provided within the build environment of tinygo. All the heavy-lifting of flasing into our micro-controllers is done by tinygo as well, making it a piece of cake 🍰 to work with micro-controllers.