ProgramGuru

Installing Go

Start with Installing Go

Installing Go gives your computer the Go compiler, standard library and the go command. A successful installation is easy to verify from a terminal.

What you’ll learn

  • Find the official Go installation packages.
  • Verify the installation in a terminal.
  • Run a small local program.

Understand the idea

Download Go from go.dev/dl, choose the installer for your operating system and architecture, and follow the instructions. On Windows you can use the MSI installer; on macOS use an appropriate installer package; on Linux follow the archive installation instructions for your distribution and architecture.

Open a new terminal after installing. Run go version to confirm the executable is on your PATH. If your terminal cannot find go, verify your installation and PATH before changing any project code.

Tools, syntax and practical notes

Terminal check

go version
go env GOROOT
go help

GOROOT identifies the Go installation location. Normally you do not need to configure it manually.

Run a complete Go example

This example is a complete program. Save it as main.go or paste it into the Go Playground.

Go code

package main

import "fmt"

func main() {
	fmt.Println("Go is ready")
}

Output

Go is ready

Trace what the program does

Once the terminal recognizes the Go toolchain, save this code as main.go and run go run main.go. Seeing Go is ready verifies that the compiler and runner work together.

Avoid common mistakes

  • Do not install both an archive and an installer on the same PATH without knowing which go command runs.
  • Do not copy an old installation path blindly; consult the current official OS-specific instructions.

Try it yourself

Check go version, create main.go with the example and run it. Record the version printed by your computer.

Tip: Edit the example above, predict the output, and run the modified code to test your reasoning.

Check your understanding

Which command confirms that the Go toolchain is accessible?
Choose one answer. You can try again.

Answer and explanation

go version

Correct. Once the terminal recognizes the Go toolchain, save this code as main.

What you should remember

You have practiced Installing Go in a small, self-contained program. The important habit is to predict what runs, inspect the actual output and distinguish the language rule from the particular example.

Before continuing, make sure you can explain the program to someone who has not seen it, including the line that changes its result.

Reaching the recap and completing the quizzes are separate milestones.

    Next lesson: Setting Up Go Development Environment →