Go on Embedded Systems and WebAssembly

https://tinygo.org/

TinyGo Home

TinyGo - A Go Compiler For Small Places Get Started See the code Go on embedded systems and WebAssembly TinyGo brings the Go programming language to embedded systems and to the modern web by creating a new compiler based on LLVM. You can compile and run TinyGo programs on over 100 different microcontroller boards from maker boards such as the BBC micro:bit and the Arduino Uno, to industrial processors from Nordic Semiconductor and ST Microelectronics.

TinyGo

Tinygo made a lot of progress over the years -- e.g. they've recently introduced macOS support!

It does indeed produce much smaller binaries, including for macOS.

yuriy@MacBookAir ~/t/tinygo> time tinygo build -o test-tiny main.go

________________________________________________________
Executed in 1.06 secs fish external
usr time 1.18 secs 0.31 millis 1.18 secs
sys time 0.18 secs 1.50 millis 0.18 secs

yuriy@MacBookAir ~/t/tinygo> time go build -o test-normal main.go

________________________________________________________
Executed in 75.79 millis fish external
usr time 64.06 millis 0.41 millis 63.64 millis
sys time 96.76 millis 1.75 millis 95.01 millis

yuriy@MacBookAir ~/t/tinygo> ll
total 5096
-rw-r--r--@ 1 yuriy staff 74B 3 Apr 19:17 main.go
-rwxr-xr-x@ 1 yuriy staff 2.3M 3 Apr 19:18 test-normal*
-rwxr-xr-x@ 1 yuriy staff 192K 3 Apr 19:18 test-tiny*
yuriy@MacBookAir ~/t/tinygo> cat main.go
package main

import "fmt"

func main() {
fmt.Printf("Hello world!\n")
}