Golang Mac OSX build for Docker machine

Here a solution to make cross-compile super easy even with CGO.

I stumbled upon it recently after wasting a lot of time getting a new windows build server to build my Go app. Now I just compile it on my Mac and will create a Linux build server with it:

https://github.com/karalabe/xgo

Many thanks to Péter Szilágyi alias karalabe for this really great package!

How to use:

  • have Docker running
  • go get github.com/karalabe/xgo
  • xgo --targets=windows/amd64 ./

There are lots more options!

-- edit --

Almost 3 Years later I'm not using this any more, but my docker image to build my application in a linux based CD pipeline is still based on the docker images used in xgo.