Cross-compilation is the process of generating a binary executable file for a different architecture than the one on which you are working.
The main benefit that you receive from cross-compilation is that you do not need a second or third machine to create executable files for different architectures. This means that you basically need just a single machine for your development. Fortunately, Go has built-in support for cross-compilation.
For the purpose of this section, we are going to use the Go code of xCompile.go to illustrate the cross-compilation process. The Go code of xCompile.go is as follows:
package main
import (
"fmt"
"runtime"
)
func main() {
fmt.Print("You are using ", runtime.Compiler, " ")
fmt.Println("on a", runtime.GOARCH, "machine")
fmt.Println("...