Golang supports cross-compilation for generating executable programs on one platform for another platform.
1. Mac
Compile 64-bit executables for Linux, Windows platforms under Mac.
2. Linux
Compiling 64-bit executable programs for Mac, Windows platforms under Linux.
3. Windows
Compiling 64-bit executable programs for Mac, Linux platforms under Windows.
GOOS
: target executable running operating system, supports darwin, freebsd, linux, windows.GOARCH
: target executable operating system architecture, including 386, amd64, arm.
Before Golang 1.5, you need to configure the cross-compilation environment when you cross-compile for the first time.