2020-04-03 - cross-compiling in golang

i'm recently working on one project in 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…

blog/2020/04/03/2020-04-03_-_cross-compiling_in_golang.txt · Last modified: 2021/06/15 20:09 by 127.0.0.1
Back to top
Valid CSS Driven by DokuWiki Recent changes RSS feed Valid XHTML 1.0