Compiling and Running Code

To build a Go program, use the go tool.To build helloworld we just enter:

  1. % go build helloworld.go

This results in an executable called helloworld.

  1. % ./helloworld
  2. Hello, world.

You can combine the above and just call go run helloworld.go.