====== 2020-04-03 - cross-compiling in golang ======
i'm recently working on one project in [[wp>golang|Go]]. this is my first above-hello-world level project in this language. there is a chance it will be open source one day, but for now let's just call it "a project". i plan to write a separate post on my impressions on the language, but one thing that was a huge positive surprise for me is cross compiling.
let's take a simple Go program:
package main
import "fmt"
func main() {
fmt.Println("hello, world!")
}
and compile it:
go build
now let's cross-compile it for Raspberry Pi:
GOOS=linux GOARCH=arm GOARM=5 go build
after nearly 2 decades of C/C++ for both regular and embedded systems, my first though here was: son of a bitch -- they can do this...