🌱 Exercise 0: Introduction and Setup

Welcome to the Go Source Code Workshop! πŸŽ‰ In this introductory exercise, you’ll set up your environment and get familiar with the Go source code repository.

🎯 Learning Objectives

By the end of this exercise, you will:

πŸ“‹ Prerequisites

Make sure you have the following installed:

⚑ Step 1: Install or Upgrade Go

⚠️ Important: You need an existing Go installation (version 1.24.6 or newer) to build Go from source. This is called “bootstrapping” - using an existing Go compiler to build the new one.

Check Your Current Go Version

go version
# Should show: go version go1.24.6 or higher

If Go is Not Installed or Too Old

If you don’t have Go installed, or your version is older than 1.24.6:

  1. πŸ“₯ Download Go: Visit https://go.dev/dl/ and download the appropriate installer for your operating system
  2. πŸ› οΈ Install Go: Follow the official installation guide for your platform:
  3. βœ… Verify Installation: Open a new terminal and run:
   go version
   # Should show: go version go1.24.6 or higher

πŸ“š Installation Help: If you need detailed installation instructions, see the official Go installation guide.

πŸ“₯ Step 2: Clone the Go Source Code

Let’s clone the official Go repository. This might take a few minutes as it’s a large repository. ⏳

git clone https://go.googlesource.com/go
cd go

🏷️ Step 3: Checkout Go Version 1.25.1

For consistency across the workshop, we’ll use Go version 1.25.1. Let’s check out the specific release tag: πŸ“Œ

git checkout go1.25.1

Verify you’re on the correct version:

git describe --tags
# Should show: go1.25.1

πŸŽ“ What We Accomplished

➑️ Next Steps

Perfect! Your environment is now set up and ready. In Exercise 1: Compiling Go Without Changes, you’ll build the Go toolchain from source and explore the Go compiler structure while it’s building! πŸ”¨