User Tools

Site Tools


Golang tips

Building for multiple platforms

Check out the source, and from the src directory, run the following loop:

$ for os in linux darwin windows; do for arch in 386 amd64; do echo ===== building $os/$arch =====; sleep 3; GOARCH=$arch GOOS=$os ./make.bash --no-clean 2>&1 ; done ;done

Then, to cross compile:

$ GOARCH=386 GOOS=windows go build maxproc.go

$ file maxproc.exe 
maxproc.exe: PE32 executable (console) Intel 80386 (stripped to external PDB), for MS Windows
en/ressources/astuces/golang.txt · Last modified: 2024/04/17 10:19 by