Cristhian Villegas
Backend8 min read2 views

Go Course #1: Introduction to Go - Installation and Hello World

Go Course #1: Introduction to Go - Installation and Hello World

Welcome to the Go Course - Part 1 of 10

Go Logo

Welcome to the Go Programming Course from Scratch. This is article 1 of 10 in a series designed to teach you how to program in Go (also known as Golang). Whether you have some programming experience or are relatively new to coding, this course will guide you from the basics to intermediate-level topics.

In this first article, we will install Go on your operating system, write your first program, and explore the basic tools you will use throughout the entire course. By the end of this read, you will have everything set up and ready to start building programs in Go.

Note: This course is composed of 10 articles that progress from basic to intermediate-advanced topics. Each article builds on what was learned in the previous one, so we recommend following them in order.

What is Go and Its History

Go is an open-source programming language created at Google in 2009 by three legendary engineers: Rob Pike, Ken Thompson (co-creator of Unix and the C language), and Robert Griesemer. They designed it because they were frustrated with the complexity of existing languages for building large-scale systems.

The project began in September 2007 and was publicly announced in November 2009. The stable version 1.0 was released in March 2012. Since then, Go has maintained a compatibility promise: code written for Go 1.0 still works in current versions.

Go takes the best from several worlds: the efficiency of C, the simplicity of Python, and modern concurrency tools that no other language at the time offered as elegantly.

Gopher, the Go mascot

Go's mascot is the Gopher, a friendly character designed by Renee French. You will see it frequently in the Go community and in the official documentation.

Why Learn Go in 2026

Go has become one of the most in-demand programming languages in the software industry. Here are concrete reasons to learn it:

  • Exceptional performance: Go compiles to native machine code. It is much faster than Python, JavaScript, or Java in most scenarios
  • Radical simplicity: Go has only 25 reserved keywords. Its syntax is minimalist and easy to learn
  • Built-in concurrency: Goroutines and channels make writing concurrent programs simple and safe
  • Ultra-fast compilation: A large project compiles in seconds, not minutes
  • Single binary: Go produces an executable with no external dependencies, ideal for deployments
  • Strong job market: Companies like Google, Uber, Twitch, Dropbox, and MercadoLibre use Go extensively
Fun fact: According to the Stack Overflow 2025 survey, Go is among the top 10 highest-paid languages and among those with the highest developer demand worldwide.

Real-World Use Cases of Go

Go is not a theoretical language — it is the foundation of tools you probably already use:

  • Docker: The most popular container system in the world is written in Go
  • Kubernetes: The container orchestrator that dominates the cloud is written in Go
  • Terraform: HashiCorp's infrastructure-as-code tool uses Go
  • Hugo: One of the fastest static site generators in the world
  • Prometheus and Grafana: Essential monitoring tools
  • APIs and microservices: Go is the preferred choice for high-performance backends
  • CLI tools: Many modern command-line tools are written in Go

If you are interested in backend development, cloud computing, DevOps, or distributed systems, Go is a language you need to master.

Installing Go on Windows, macOS, and Linux

Let us install Go on your operating system. The process is straightforward on any platform.

Installation on Windows

  1. Go to the official page: go.dev/dl
  2. Download the .msi file for Windows
  3. Run the installer and follow the instructions (accept the default values)
  4. The installer automatically adds Go to your PATH
  5. Open a new terminal (Command Prompt or PowerShell) and verify the installation

Installation on macOS

  1. Download the .pkg file from go.dev/dl
  2. Open the downloaded file and follow the installation wizard
  3. Go will be installed at /usr/local/go

You can also use Homebrew:

bash
1brew install go

Installation on Linux

Download and extract the compressed file:

bash
1# Download Go (adjust the version if a newer one is available)
2wget https://go.dev/dl/go1.23.0.linux-amd64.tar.gz
3
4# Remove previous installation and extract
5sudo rm -rf /usr/local/go
6sudo tar -C /usr/local -xzf go1.23.0.linux-amd64.tar.gz
7
8# Add Go to PATH (add this to your ~/.bashrc or ~/.zshrc)
9export PATH=$PATH:/usr/local/go/bin

Verify the Installation

On any operating system, open a terminal and run:

bash
1go version

You should see something like: go version go1.23.0 linux/amd64. If you see that message, Go is installed correctly.

Important: If the go version command does not work, make sure you opened a new terminal after installation. On Linux, verify that you added the PATH line to your shell configuration file.

GOPATH and Workspace Structure

In older versions of Go, all your code had to live inside a special folder called GOPATH. Since Go 1.11, with the introduction of Go Modules, this is no longer required, but it is important to understand the structure:

  • GOPATH: The directory where Go stores downloaded packages. By default, it is $HOME/go
  • GOROOT: The directory where Go is installed. Typically /usr/local/go

You can check these values with:

bash
1go env GOPATH
2go env GOROOT

For new projects, simply create a folder wherever you want and initialize a module:

bash
1mkdir my-project
2cd my-project
3go mod init my-project

This creates a go.mod file that manages your project's dependencies. It is the equivalent of Node.js's package.json or Java's pom.xml.

Your First Program: Hello World

Now the best part: let us write and run your first Go program. Create a file called main.go with the following content:

go
1package main
2
3import "fmt"
4
5func main() {
6    fmt.Println("Hello, world from Go!")
7}

Let us break down each line:

  • package main: Every executable Go program must belong to the main package. It is the entry point.
  • import "fmt": We import the fmt (format) package from the standard library, which allows us to print text to the console.
  • func main(): The main function is the first function that runs when you execute the program. Every Go program must have exactly one.
  • fmt.Println(...): Prints the text in quotes followed by a newline character.
Notice: In Go, the opening brace { must be on the same line as the function declaration. If you put it on the next line, the compiler will throw an error. This is a design decision to enforce a uniform code style.

Running and Compiling Your Program

There are two main ways to execute your Go code:

Option 1: go run (run directly)

bash
1go run main.go

This command compiles and runs the program in a single step. It is ideal for development and quick testing. You will see in the terminal:

bash
1Hello, world from Go!

Option 2: go build (compile to binary)

bash
1go build -o hello main.go
2./hello

This command generates an executable file called hello that you can distribute and run on any machine with the same operating system, without needing Go installed. This is one of Go's greatest advantages: you produce a self-contained binary.

Cross-compilation: Go can generate binaries for other operating systems. For example, from Linux you can compile for Windows with: GOOS=windows GOARCH=amd64 go build -o hello.exe main.go

Go Playground: Experiment Without Installing Anything

If you want to experiment with Go without installing anything on your computer, you can use the Go Playground at go.dev/play. It is an online editor where you can write, run, and share Go code directly from your browser.

It is an excellent tool for:

  • Quickly testing code snippets
  • Sharing examples with other developers
  • Learning while following this course if you cannot install Go on your machine

Try copying the Hello World program from above and running it in the Playground to verify it works.

Course Roadmap: 10 Articles

This course is designed as a progressive series of 10 articles. Here is a summary of what we will cover:

  1. Introduction, installation, and Hello World (this article)
  2. Variables, data types, and constants
  3. Control structures: if, switch, and loops
  4. Functions and error handling
  5. Arrays, slices, and maps
  6. Structs, methods, and interfaces
  7. Pointers and memory management
  8. Concurrency: goroutines and channels
  9. Packages, modules, and testing
  10. Final project: REST API with Go

Each article includes detailed explanations, working code examples, and practical exercises. We recommend you type and run each example yourself to reinforce what you learn.

You now have Go installed and have run your first program. In the next article (Part 2 of 10), we will learn about variables, data types, and constants — the fundamental building blocks of any Go program. You will discover how Go handles types statically and why that is an advantage.

Share:
CV

Cristhian Villegas

Software Engineer specializing in Java, Spring Boot, Angular & AWS. Building scalable distributed systems with clean architecture.

Comments

Sign in to leave a comment

No comments yet. Be the first!

Related Articles