---
title: "Learn Go"
slug: "learn-go"
description: "Write, run and test small Go programs: slices, maps, errors, structs, interfaces, generics, goroutines, context and a tested command-line tool."
published: "2026-12-03"
updated: "2026-12-03"
canonical: "https://aifree.dev/courses/learn-go"
---

# Learn Go

Write, run and test small Go programs: slices, maps, errors, structs, interfaces, generics, goroutines, context and a tested command-line tool.

Go · Beginner · 110 min

## 1. First steps

- [Install Go and run your first program](https://aifree.dev/courses/learn-go/hello-go.md) (8 min): Install Go, create a module and run a first program with go run. You see what package main and func main do and how go run differs from go build.
- [Variables, types and constants in Go](https://aifree.dev/courses/learn-go/variables-and-types.md) (10 min): Declare variables with var and :=, see zero values and types printed with %T, convert between numbers and use const. Fix a mismatched-types error.

## 2. Data and functions

- [Slices and maps in Go](https://aifree.dev/courses/learn-go/slices-and-maps.md) (11 min): Use slices as lists and maps as lookup tables: append, len, sub-slices, range, missing keys and the ok form. Fix a panic caused by a nil map.
- [Functions, multiple returns and errors in Go](https://aifree.dev/courses/learn-go/functions-and-errors.md) (11 min): Write functions with several results, return an error next to the value, check it with if err != nil, wrap it with %w and test it with errors.Is.
- [Structs and methods in Go](https://aifree.dev/courses/learn-go/structs-and-methods.md) (11 min): Group fields in a struct, add methods with value and pointer receivers, and see fmt use a String method. Fix a method that changes only a copy.

## 3. Interfaces and generics

- [Interfaces in Go: behaviour without classes](https://aifree.dev/courses/learn-go/interfaces.md) (10 min): Describe behaviour with an interface, let types satisfy it by having the methods, and use any, type switches and fmt.Stringer. Fix a missing method.
- [Generics in Go: one function, many types](https://aifree.dev/courses/learn-go/generics.md) (10 min): Write one function for many types with type parameters, constraints such as cmp.Ordered and your own union, and a generic Stack type. Fix a constraint error.

## 4. Concurrency and projects

- [Goroutines and channels: work at the same time](https://aifree.dev/courses/learn-go/goroutines-and-channels.md) (12 min): Start goroutines with go, wait with sync.WaitGroup, pass values over channels, build a small pipeline and use select. Fix a deadlock.
- [Context in Go: timeouts and cancellation](https://aifree.dev/courses/learn-go/context-and-cancellation.md) (12 min): Pass a context.Context to running work, cancel it with WithCancel, set limits with WithTimeout and check ctx.Err(). Fix a function that ignores its context.
- [Packages, modules and go test](https://aifree.dev/courses/learn-go/packages-modules-and-tests.md) (15 min): Know what a package and a module are, what makes a name exported, how to write table-driven tests with go test and how to build a small command-line tool.

## Free AI coding tools to practise with

1. [AgentRouter Free Credits](https://aifree.dev/offer/agentrouter-free-credits.md) : Free AI coding credits: $25 per daily check-in and $50 per invite. No card. Verified 2026-11-28. Claim: https://agentrouter.org/register?aff=N5wg
2. [Cursor Free Plan](https://aifree.dev/offer/cursor-hobby-plan.md) : Cursor Agent with limited agent and chat requests, $0/month. No card. Verified 2026-11-29. Claim: https://cursor.com/pricing?ref=aifree.dev
3. [Cline Free Models](https://aifree.dev/offer/cline-free-models.md) : Try select models free in Cline via rotating promotions with a usage quota. No card. Verified 2026-11-06. Claim: https://cline.bot?ref=aifree.dev

[All offers](https://aifree.dev/free-ai-coding-tools.md)
