PidokuInfra

Golang Engineering

Go from the first program to the runtime — how values sit in memory, how the allocator, garbage collector and scheduler work, and how to build AI systems in it.

Start reading
  • 5 levels
  • 6 modules
  • 37 topics
  • ~33h 5m

Contents

  1. Foundations

    Build the mental model.

    5 topics · ~3h 45m

    1. 01 The LanguageGo is a small language. This module covers all of it that you need daily, quickly, and with one eye already on what each feature costs. 5 topics · ~3h 45m
      1. 00Module overview
      2. 01Why Go, and the ToolchainBeginner30 min
      3. 02Values, Types and Zero ValuesBeginner45 min
      4. 03Functions, Errors and DeferBeginner50 min
      5. 04Structs, Methods and InterfacesBeginner50 min
      6. 05Packages, Modules and TestingBeginner50 min
  2. Basic

    Understand the core mechanisms.

    6 topics · ~5h

    1. 02 Data in MemoryModule I said slices, strings, maps and interfaces are "small headers that point elsewhere". This module draws each header, byte by byte, and shows what follows from the drawing. 6 topics · ~5h
      1. 00Module overview
      2. 01Arrays and SlicesBeginner55 min
      3. 02Strings, Bytes and RunesBeginner45 min
      4. 03MapsIntermediate50 min
      5. 04Pointers and Struct LayoutIntermediate50 min
      6. 05Interfaces Under the HoodIntermediate50 min
      7. 06Generics and IteratorsIntermediate50 min
  3. Intermediate

    Learn the optimization techniques.

    11 topics · ~10h 25m

    1. 03 MemoryGo manages memory for you. This module explains exactly how, because the difference between a service that spends 2% of its CPU on memory management and one that spends 30% is almost always … 5 topics · ~4h 45m
      1. 00Module overview
      2. 01Stack and HeapIntermediate45 min
      3. 02Escape AnalysisIntermediate55 min
      4. 03The AllocatorAdvanced1h
      5. 04The Garbage CollectorAdvanced1h 10m
      6. 05Writing Allocation-Aware CodeAdvanced55 min
    2. 04 ConcurrencyGoroutines are why most people choose Go. This module explains what one actually is, how the runtime runs millions of them on a handful of threads, and how to write concurrent code that is … 6 topics · ~5h 40m
      1. 00Module overview
      2. 01Goroutines and the SchedulerIntermediate1h
      3. 02ChannelsIntermediate55 min
      4. 03Select, Context and CancellationIntermediate55 min
      5. 04Sync and AtomicsIntermediate55 min
      6. 05The Memory Model and Data RacesAdvanced50 min
      7. 06Concurrency PatternsAdvanced1h 5m
  4. Advanced

    Study systems at production scale.

    5 topics · ~4h 40m

    1. 05 PerformanceModules III and IV explained what the runtime does. This module is about measuring a program, understanding what the compiler and the CPU did with it, and making it faster on purpose. 5 topics · ~4h 40m
      1. 00Module overview
      2. 01Benchmarking and ProfilingAdvanced1h
      3. 02The CompilerAdvanced55 min
      4. 03Cache-Friendly DataAdvanced55 min
      5. 04cgo, SIMD and AssemblyAdvanced55 min
      6. 05Networking and the NetpollerAdvanced55 min
  5. Expert

    Design platforms and read the frontier.

    9 topics · ~9h 15m

    1. 06 AI in GoEverything so far, applied. This module builds the core pieces of an AI system in Go using nothing but the standard library: the arithmetic, a network that learns, a tokenizer, a transformer … 9 topics · ~9h 15m
      1. 00Module overview
      2. 01Go in the AI StackAdvanced40 min
      3. 02Tensors and MatmulAdvanced1h 5m
      4. 03A Neural Network from ScratchAdvanced1h 10m
      5. 04A TokenizerAdvanced55 min
      6. 05A Transformer Forward PassExpert1h 30m
      7. 06Calling LLMsAdvanced1h
      8. 07Embeddings and Vector SearchAdvanced1h
      9. 08Serving Models from GoExpert1h 5m
      10. 09A Tool-Calling LoopExpert50 min

Build

Reference

About

Learn Go the way a systems engineer needs it: what every value looks like in memory, what the allocator, garbage collector and scheduler do on your behalf, how to measure and speed up a program — and how to build neural networks, tokenizers, LLM clients and model servers in it.

Every other path in this library writes its code in Go. This is the path about Go itself. It starts at “what is a variable” and ends with a transformer forward pass and a batching model server, both written from nothing but the standard library.

It assumes you have programmed in some language. It does not assume you know Go, C, or how a garbage collector works.


How this course works#

Every lesson follows the same shape:

  1. The idea in one minute — the whole lesson in a few sentences.
  2. An analogy — something from everyday life with the same shape.
  3. A picture — a hand-drawn diagram, usually of memory.
  4. How it really works — the precise version, with real sizes and names.
  5. Code — a small Go program you can run. Nearly all of them measure the thing the lesson claims, so you never have to take the text’s word for it.
  6. Remember this — the three or four facts worth keeping.
  7. Try it and Check yourself — exercises and questions.

Why draw memory?#

Most Go surprises are memory surprises: a slice that changes behind your back, an interface that is “nil but not nil”, a goroutine that leaks, a program that spends a third of its time in the garbage collector. Each one stops being a surprise once you can draw the bytes.

flowchart TB
  SRC["Your code<br/>values, pointers, goroutines"] --> CMP["Compiler<br/>escape analysis, inlining"]
  CMP --> BIN["One static binary<br/>your code + the runtime"]
  subgraph RT["The Go runtime, inside your process"]
    SCH["Scheduler<br/>goroutines onto threads"]
    ALC["Allocator<br/>size classes, spans"]
    GC["Garbage collector<br/>concurrent mark and sweep"]
  end
  BIN --> RT
  RT --> OS["Operating system<br/>threads, memory pages, sockets"]
  class SRC neutral
  class CMP,BIN compute
  class SCH queue
  class ALC,GC memory
  class OS io

The path#

flowchart LR
  I["I The language"] --> II["II Data in memory"]
  II --> III["III Memory"]
  III --> IV["IV Concurrency"]
  IV --> V["V Performance"]
  V --> VI["VI AI in Go"]
  class I neutral
  class II,III memory
  class IV queue
  class V compute
  class VI io
ModuleYou will be able toLevel
I — The LanguageRead and write idiomatic Go: values, functions, errors, structs, interfaces, packages, testsFoundations
II — Data in MemoryDraw a slice, string, map, struct and interface as bytes, and predict what a copy sharesBasic
III — MemoryExplain stack vs heap, read escape analysis, describe the allocator and the garbage collector, and cut allocationsIntermediate
IV — ConcurrencyExplain the scheduler, use channels, context and sync correctly, and reason about data racesIntermediate
V — PerformanceBenchmark and profile, read what the compiler did, lay out data for the cache, and know what cgo and SIMD costAdvanced
VI — AI in GoBuild tensors, a trained neural network, a tokenizer, a transformer forward pass, an LLM client, vector search and a batching model serverExpert
ProjectsBuild six programs that make the ideas stickAll

What you need#

  • Go 1.22 or newer. Every runnable program in the course builds with it. Lessons mark the few features that need a newer release and show them as snippets.
  • A terminal. No other tools, no GPU, no Python.

Getting started in fifteen minutes#

  1. Install Go from go.dev/dl and run go version.
  2. Read I.01 and run its program with go run.
  3. If you already write Go, start at II.01 — module II is where the pictures begin — or go straight to III.02 Escape analysis.
  4. If you came for the AI part, read VI.01 first; it says which earlier lessons each AI lesson leans on.

A note on versions#

Go releases every six months and keeps a strict compatibility promise: code written for Go 1.0 still compiles. The language changes slowly; the runtime improves constantly. On 3 October 2026, when this course was last checked, the current release was Go 1.27 (August 2026). What recent releases changed, in the order the course meets them:

ReleaseWhat changedLesson
1.22 (Feb 2024)Each loop iteration gets its own variable; range over an integerI.03
1.23 (Aug 2024)Range over functions (iterators)II.06
1.24 (Feb 2025)Maps rebuilt as Swiss tables; testing.B.Loop; weak pointersII.03, V.01
1.25 (Aug 2025)GOMAXPROCS respects container CPU limits; testing/synctest; sync.WaitGroup.GoIV.01, IV.04
1.26 (Feb 2026)“Green Tea” garbage collector on by default; new(expr); cheaper cgo callsIII.04, V.04
1.27 (Aug 2026)Generic methods; encoding/json/v2; faster small allocations; goroutine-leak profileII.06, III.03, IV.06

Runtime internals — sizes, thresholds, algorithms — are implementation details and do change. Wherever the course quotes one, the program beside it measures it on your machine.

Sister paths#

↑↓ navigate↵ openesc close