Course

Go from the ground up

Simple code that runs at scale

  • Beginner
  • 12 chapters
  • 184 min read

Learn Go by running it: values and types, slices and maps, structs with methods, interfaces, errors as values, pointers and text, goroutines and channels, packages and tests, generics, and a worker pool that uses the whole language at once.

What You'll Learn

  • Write and run a Go program, and read what the compiler refuses
  • Make variables two ways, and know every value starts at its zero value
  • Write functions that return several values, and loop with the one for keyword
  • Keep data in slices and maps, and use comma-ok to tell absent from empty
  • Model things with structs, and pick the right receiver for the method
  • Describe behaviour with small interfaces and satisfy them implicitly
  • Return, wrap and inspect errors instead of throwing them
  • Use pointers where Go actually does, and treat text as bytes and runes
  • Start goroutines, move values on channels, and wait without guessing
  • Arrange a project into packages and modules, with tests beside the code
  • Write generic functions and types with constraints that mean something
  • Build a worker pool: jobs in, results out, and no shared memory to guard

Prerequisites

  • No Go at all — the course starts at package main
  • Any experience with one other language makes the first chapters quicker, but none is assumed

Course Content

  1. 01
    Your first Go program

    What Go is for, the three lines every program starts with, and a first run — on the server here, or with the go command on your own machine.

    Beginner · 12 min read

    Not started
  2. 02
    Values, types and zero values

    Making variables two ways, the small set of built-in types, the value every variable starts with, and why Go never converts a type behind your back.

    Beginner · 13 min read

    Not started
  3. 03
    Functions and control flow

    Functions that give back more than one value, the single for loop that covers every repetition, switch without fall-through, and defer — Go's way of saying "when this function ends".

    Beginner · 14 min read

    Not started
  4. 04
    Slices and maps

    The two collections every Go program uses: a slice is a growable list, a map is a lookup by key, and both of them have one behaviour worth learning exactly.

    Beginner · 15 min read

    Not started
  5. 05
    Structs and methods

    Making your own types out of fields, hanging functions off them, and the one distinction that matters: a method that works on a copy, and a method that works on the real thing.

    Intermediate · 15 min read

    Not started
  6. 06
    Interfaces

    Behaviour described as a set of methods, satisfied without ever saying so, and the small interfaces that keep Go code easy to swap and easy to test.

    Intermediate · 16 min read

    Not started
  7. 07
    Errors as values

    Errors are ordinary values that travel beside results, wrapped with context as they move up, and compared with the tools that understand wrapping.

    Intermediate · 16 min read

    Not started
  8. 08
    Pointers, and text done properly

    What a pointer actually is — an address, not a mystery — why Go uses them in exactly two places, and how text really works: bytes, runes and the builder that avoids a copy per line.

    Intermediate · 15 min read

    Not started
  9. 09
    Goroutines and channels

    Starting work that runs at the same time, sending values between the parts instead of sharing them, and the two tools for waiting: a WaitGroup and a closing channel.

    Advanced · 18 min read

    Not started
  10. 10
    Packages, modules and tests

    How a Go project is arranged on disk, what the capital letter on a name means, and the test style the whole language uses: a table of cases, one loop, no framework.

    Advanced · 15 min read

    Not started
  11. 11
    Generics

    Writing one function for many types without giving up the types: type parameters, constraints that say what T can do, and knowing when a plain interface is still the better answer.

    Advanced · 15 min read

    Not started
  12. 12
    Putting it together: a worker pool

    A capstone program that uses the whole course at once — structs and methods, an interface, errors as values, a pool of goroutines and channels to collect their work.

    Advanced · 20 min read

    Not started