O'Reilly logo

Isomorphic Go by Kamesh Balasubramanian

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Cross compiling IGWEB

Using the go build command, we can actually build binaries for different target operating systems, a technique known as cross compiling. For example, on my macOS machine, I can build a 64-bit Linux binary that we can push out to the standalone production server running Ubuntu Linux. Prior to building our binary, we specify the target operating system we want to build to by setting the GOOS environment variable:

$ export GOOS=linux

By setting the GOOS environment variable to linux, we have specified that we wish to generate a binary file for Linux.

In order to specify that we want the binary to be a 64-bit binary, we set the GOARCH environment variable to specify the target architecture:

$ export GOARCH=amd64

By setting ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required