Skip to content

Learn Go from Python

A personal, opinionated set of conspect notes for a Python developer picking up Go. The goal is to explain Go on its own terms, with short Python analogies thrown in only when they sharpen the contrast.

All material targets the current stable Go release, Go 1.26.4.

How the notes are organised

Each topic is a numbered folder. Inside each folder, conspects and runnable code examples share one numeric sequence so the reading order is always obvious.

Ecosystem and installation

Language basics

  • Variables and constantsvar, :=, const, and iota.
  • Basic types — integers, floats, strings, booleans; no truthiness.
  • Type conversions — explicit T(x), strconv, no implicit coercion.
  • Operators — arithmetic, overflow, integer division; no ternary.
  • Control flowif, for (the only loop), switch.
  • Functions — multiple returns, named results, variadics, first-class values.
  • Errors — the error value, wrapping with %w, errors.Is/As.
  • Pointers&/*, nil, new, no pointer arithmetic.
  • Custom typestype definitions vs aliases, underlying types.
  • Structs — fields, literals, zero value, embedding, tags.
  • Arrays and slices — len/cap, append, and the shared-backing gotcha.
  • Maps — keyed lookup, comma-ok, the nil-map trap, sets.
  • Choosing a data structure — slice vs map vs struct vs custom type.
  • Defer — deferred calls, LIFO order, cleanup patterns.
  • Panic and recover — when to panic, recovering in deferred calls.
  • Imports — import paths, aliases, blank and dot imports.

Object-oriented Go

Packages and modules

Concurrency

  • Goroutinesgo, scheduling, WaitGroup, the main-exits trap.
  • Channels — send/receive, buffering, close, range, deadlocks.
  • select — multiplexing, default, timeouts, done-channels.
  • SynchronizationMutex, Once, atomics, the race detector.
  • Context — cancellation, deadlines, propagation.
  • Concurrency patterns — worker pools, fan-out/fan-in, pipelines.

Source