Go · Stage 11 – Beyond the Basics · Lesson 63 of 64

Building an Executable

Compile a module into a runnable file.

Go code

go build -o hello .
Line-by-line explanation
  1. Go starts the toolchain.
  2. Build requests compilation.
  3. -o hello names the output file.
  4. Dot selects the current package.
Expected output
(no output)

A successful build is normally silent and creates hello or hello.exe.

The executable can run without the Go toolchain on a compatible operating system and architecture.