In this section, you will learn how Go code is converted into machine code in much more detail. The Go program that is going to be used in this example is named machineCode.go and it is going to be presented in two parts.
The first part of machineCode.go is as follows:
package main import ( "fmt" ) func hello() { fmt.Println("Hello!") }
The second and final part of machineCode.go is as follows:
func main() { hello() }
After that, you can see machineCode.go translated into machine code as follows:
$ GOSSAFUNC=main GOOS=linux GOARCH=amd64 go build -gcflags "-S" machineCode.go # runtime dumped SSA to /usr/local/Cellar/go/1.12.4/libexec/src/runtime/ssa.html # command-line-arguments dumped SSA to ./ssa.html os.(*File).close STEXT dupok nosplit size=26 args=0x18 locals=0x0 0x0000 00000 (<autogenerated...