Go, by example

Go by example - annotated code snippets covering the language from first principles to production.

85 lessons ยท Updated 2026-04-26

  1. 01Hello, World
  2. 02Values
  3. 03Variables
  4. 04Constants
  5. 05For
  6. 06If/Else
  7. 07Switch
  8. 08Arrays
  9. 09Slices
  10. 10Maps
  11. 11Functions
  12. 12Closures
  13. 13Pointers
  14. 14Structs
  15. 15Methods
  16. 16Multiple Return Values
  17. 17Variadic Functions
  18. 18Recursion
  19. 19Range over Built-in Types
  20. 20Strings and Runes
  21. 21Interfaces
  22. 22Enums
  23. 23Struct Embedding
  24. 24Generics
  25. 25Range over Iterators
  26. 26Errors
  27. 27Custom Errors
  28. 28Goroutines
  29. 29Channels
  30. 30Channel Buffering
  31. 31Channel Synchronization
  32. 32Channel Directions
  33. 33Select
  34. 34Timeouts
  35. 35Non-Blocking Channel Operations
  36. 36Closing Channels
  37. 37Range over Channels
  38. 38Timers
  39. 39Tickers
  40. 40Worker Pools
  41. 41WaitGroups
  42. 42Rate Limiting
  43. 43Atomic Counters
  44. 44Mutexes
  45. 45Stateful Goroutines
  46. 46Sorting
  47. 47Sorting by Functions
  48. 48Panic
  49. 49Defer
  50. 50Recover
  51. 51String Functions
  52. 52String Formatting
  53. 53Text Templates
  54. 54Regular Expressions
  55. 55JSON
  56. 56XML
  57. 57Time
  58. 58Epoch
  59. 59Time Formatting / Parsing
  60. 60Random Numbers
  61. 61Number Parsing
  62. 62URL Parsing
  63. 63SHA256 Hashes
  64. 64Base64 Encoding
  65. 65Reading Files
  66. 66Writing Files
  67. 67Line Filters
  68. 68File Paths
  69. 69Directories
  70. 70Temporary Files and Directories
  71. 71Embed Directive
  72. 72Testing and Benchmarking
  73. 73Command-Line Arguments
  74. 74Command-Line Flags
  75. 75Command-Line Subcommands
  76. 76Environment Variables
  77. 77Logging
  78. 78HTTP Client
  79. 79HTTP Server
  80. 80TCP Server
  81. 81Context
  82. 82Spawning Processes
  83. 83Exec'ing Processes
  84. 84Signals
  85. 85Exit

Enjoyed this? Get more essays on software craft delivered to your inbox.

Subscribe free