Skip to content

Table of Contents

Month 1 — Runnable Examples

Single-concept, stdlib-only programs that back the Week 2 daily notes (composite types). Each folder is its own package main.

How to run

go run ./examples/month-01/<topic>

Index (Week 2 — composite types)

Topic Concept Day
slice-internals/ array vs slice, len/cap, backing array, append + aliasing traps 008–009
slice-tricks/ filter in place, insert, delete (ordered & fast), copy 010
maps-sets/ comma-ok, nil-map trap, map[T]struct{} sets, ordered iteration 011
strings-runes/ bytes vs runes, UTF-8, utf8, strings.Builder, reverse 012
structs-tags/ structs, value vs pointer receivers, embedding, JSON tags 013

Index (Week 3 — methods, interfaces, errors)

Topic Concept Day
methods/ methods, value vs pointer receivers, method values/expressions 015
interfaces/ implicit satisfaction, method sets, nil-interface trap, type switch 016–017
errors/ %w wrapping, sentinel/custom errors, errors.Is/As/Join 018–019
panic-recover/ panic, deferred recover, Must helpers, error boundary 020

Index (Week 4 — embedding & generics)

Topic Concept Day
embedding/ struct & interface embedding, promotion, shadowing, decorator 022
generics/ type params, any/comparable/cmp.Ordered/union (~) constraints, inference 023
generic-ds/ generic Stack[T] & Set[T], zero-value returns, nil-map trap 024
cli-flags/ flag subcommands, FlagSet, positional args, run() error pattern 026

The Week-4 capstone (taskcli: model + atomic JSON store + CLI) is multi-file and lives under projects/taskcli/; its JSON/flag mechanics are shown stdlib-only in structs-tags/ and cli-flags/ here.

Conventions

  • One concept per folder; heavily commented as teaching artifacts.
  • Standard library only — these compile under the repo root module.

Examples