[{"data":1,"prerenderedAt":908},["ShallowReactive",2],{"page-\u002Fgo":3},{"id":4,"title":5,"body":6,"description":900,"extension":901,"meta":902,"navigation":903,"path":904,"seo":905,"stem":906,"__hash__":907},"content\u002Fgo\u002Findex.md","Learn Go — From Zero to Principal",{"type":7,"value":8,"toc":880},"minimark",[9,14,18,23,58,62,82,86,91,249,253,412,416,540,544,744,748,752,755,759,762,766,769,773,808,812],[10,11,13],"h1",{"id":12},"learn-go-from-zero-to-principal","🐹 Learn Go — From Zero to Principal",[15,16,17],"p",{},"A deep-dive, code-first engineering reference. Every chapter is structured around annotated production code, anti-patterns with fixes, edge cases, and gotchas — not prose tutorials.",[19,20,22],"h2",{"id":21},"how-to-use-this-course","How to Use This Course",[24,25,26,34,40,46,52],"ol",{},[27,28,29,33],"li",{},[30,31,32],"strong",{},"Read sequentially"," for a structured path (01 → 28).",[27,35,36,39],{},[30,37,38],{},"Jump to a chapter"," as a reference when you hit a concept in production.",[27,41,42,45],{},[30,43,44],{},"Run the code"," — every snippet is self-contained and runnable.",[27,47,48,51],{},[30,49,50],{},"Run the quizzes"," at the end of each chapter to test understanding.",[27,53,54,57],{},[30,55,56],{},"Do the capstone exercises"," in chapter 28.",[19,59,61],{"id":60},"prerequisites","Prerequisites",[63,64,65,73,76,79],"ul",{},[27,66,67,68,72],{},"Go 1.22+ installed (",[69,70,71],"code",{},"go version",").",[27,74,75],{},"A code editor (VS Code + the Go extension recommended).",[27,77,78],{},"Comfort with at least one other programming language.",[27,80,81],{},"Understanding of basic concurrency concepts (threads, locks, queues).",[19,83,85],{"id":84},"curriculum","Curriculum",[87,88,90],"h3",{"id":89},"part-i-foundations-toolchain","Part I — Foundations & Toolchain",[92,93,94,110],"table",{},[95,96,97],"thead",{},[98,99,100,104,107],"tr",{},[101,102,103],"th",{},"#",[101,105,106],{},"Topic",[101,108,109],{},"Why It Matters",[111,112,113,137,170,188,210,228],"tbody",{},[98,114,115,119,126],{},[116,117,118],"td",{},"01",[116,120,121],{},[122,123,125],"a",{"href":124},"\u002Fgo\u002F01-introduction-and-setup","Introduction & Setup",[116,127,128,129,132,133,136],{},"Toolchain internals, module graph (MVS), build tags, cross-compilation, ",[69,130,131],{},"embed",", ",[69,134,135],{},"cgo",", race detector, Docker.",[98,138,139,142,148],{},[116,140,141],{},"02",[116,143,144],{},[122,145,147],{"href":146},"\u002Fgo\u002F02-hello-world-and-go-command","Package Anatomy & go Command",[116,149,150,151,154,155,158,159,162,163,162,166,169],{},"Compilation pipeline, ",[69,152,153],{},"init()"," ordering, ",[69,156,157],{},"go"," subcommands, test cache, ",[69,160,161],{},"os.Args","\u002F",[69,164,165],{},"flag",[69,167,168],{},"cobra",".",[98,171,172,175,181],{},[116,173,174],{},"03",[116,176,177],{},[122,178,180],{"href":179},"\u002Fgo\u002F03-variables-constants-and-types","Variables, Constants & Types",[116,182,183,184,187],{},"Zero-value memory layout, untyped constant precision, ",[69,185,186],{},"iota"," bit flags, named types, shadowing trap.",[98,189,190,193,199],{},[116,191,192],{},"04",[116,194,195],{},[122,196,198],{"href":197},"\u002Fgo\u002F04-basic-types-and-conversions","Basic Types & Conversions",[116,200,201,202,205,206,209],{},"Integer overflow, IEEE 754 float traps, UTF-8 string internals, ",[69,203,204],{},"[]byte","↔",[69,207,208],{},"string"," allocation cost.",[98,211,212,215,221],{},[116,213,214],{},"05",[116,216,217],{},[122,218,220],{"href":219},"\u002Fgo\u002F05-functions","Functions",[116,222,223,224,227],{},"Multiple returns, closure capture semantics, ",[69,225,226],{},"defer"," execution model, variadic options pattern.",[98,229,230,233,239],{},[116,231,232],{},"06",[116,234,235],{},[122,236,238],{"href":237},"\u002Fgo\u002F06-control-flow","Control Flow",[116,240,241,244,245,248],{},[69,242,243],{},"if","-init scoping, ",[69,246,247],{},"range"," internals, switch dispatch, labeled breaks, Go 1.22 loop scoping fix.",[87,250,252],{"id":251},"part-ii-data-structures-memory","Part II — Data Structures & Memory",[92,254,255,265],{},[95,256,257],{},[98,258,259,261,263],{},[101,260,103],{},[101,262,106],{},[101,264,109],{},[111,266,267,289,303,321,335,349,367,385],{},[98,268,269,272,278],{},[116,270,271],{},"07",[116,273,274],{},[122,275,277],{"href":276},"\u002Fgo\u002F07-arrays-slices-and-strings","Arrays, Slices & Strings",[116,279,280,281,284,285,288],{},"Slice header memory layout, ",[69,282,283],{},"append"," growth strategy, aliasing traps, ",[69,286,287],{},"slices"," package, zero-allocation strings.",[98,290,291,294,300],{},[116,292,293],{},"08",[116,295,296],{},[122,297,299],{"href":298},"\u002Fgo\u002F08-maps","Maps",[116,301,302],{},"Hash map bucket layout, the non-addressable value trap, concurrent map fatal error, ordered map impl.",[98,304,305,308,314],{},[116,306,307],{},"09",[116,309,310],{},[122,311,313],{"href":312},"\u002Fgo\u002F09-structs","Structs",[116,315,316,317,320],{},"Field alignment\u002Fpadding, embedding composition, struct tags, zero-value-is-useful idiom, ",[69,318,319],{},"struct{}"," sets.",[98,322,323,326,332],{},[116,324,325],{},"10",[116,327,328],{},[122,329,331],{"href":330},"\u002Fgo\u002F10-pointers","Pointers",[116,333,334],{},"Escape analysis (stack vs heap), value vs pointer method sets, nil receiver safety, when pointers hurt.",[98,336,337,340,346],{},[116,338,339],{},"11",[116,341,342],{},[122,343,345],{"href":344},"\u002Fgo\u002F11-methods-and-receivers","Methods & Receivers",[116,347,348],{},"Value vs pointer semantics, consistency rule, nil receiver methods, method promotion, builder pattern.",[98,350,351,354,360],{},[116,352,353],{},"12",[116,355,356],{},[122,357,359],{"href":358},"\u002Fgo\u002F12-interfaces","Interfaces",[116,361,362,363,366],{},"Interface internals ",[69,364,365],{},"(type, value)",", the nil interface trap, consumer-side definition, accept-interfaces-return-structs.",[98,368,369,372,378],{},[116,370,371],{},"13",[116,373,374],{},[122,375,377],{"href":376},"\u002Fgo\u002F13-type-assertions-and-switches","Type Assertions & Switches",[116,379,380,381,384],{},"Comma-ok assertions, type switch dispatch, interface-to-interface capability checks, JSON ",[69,382,383],{},"float64"," trap.",[98,386,387,390,396],{},[116,388,389],{},"14",[116,391,392],{},[122,393,395],{"href":394},"\u002Fgo\u002F14-generics","Generics",[116,397,398,399,402,403,132,406,162,408,411],{},"Type parameters, ",[69,400,401],{},"~T"," underlying-type matching, ",[69,404,405],{},"cmp.Ordered",[69,407,287],{},[69,409,410],{},"maps"," packages, generic type design.",[87,413,415],{"id":414},"part-iii-error-handling-concurrency","Part III — Error Handling & Concurrency",[92,417,418,428],{},[95,419,420],{},[98,421,422,424,426],{},[101,423,103],{},[101,425,106],{},[101,427,109],{},[111,429,430,455,469,487,504,518],{},[98,431,432,435,441],{},[116,433,434],{},"15",[116,436,437],{},[122,438,440],{"href":439},"\u002Fgo\u002F15-error-handling","Error Handling",[116,442,443,444,162,447,450,451,454],{},"Error wrapping chains, ",[69,445,446],{},"errors.Is",[69,448,449],{},"As",", sentinel vs typed errors, nil-interface trap, ",[69,452,453],{},"errors.Join",", panic-vs-error.",[98,456,457,460,466],{},[116,458,459],{},"16",[116,461,462],{},[122,463,465],{"href":464},"\u002Fgo\u002F16-goroutines","Goroutines",[116,467,468],{},"G-M-P scheduling model, stack growth, GOMAXPROCS, leak prevention, unbounded fan-out, preemption.",[98,470,471,474,480],{},[116,472,473],{},"17",[116,475,476],{},[122,477,479],{"href":478},"\u002Fgo\u002F17-channels","Channels",[116,481,482,483,486],{},"Channel semantics table, close rules, directional channels, nil channel patterns, ",[69,484,485],{},"chan struct{}"," signals.",[98,488,489,492,498],{},[116,490,491],{},"18",[116,493,494],{},[122,495,497],{"href":496},"\u002Fgo\u002F18-select-and-multiplexing","Select & Multiplexing",[116,499,500,503],{},[69,501,502],{},"time.After"," leak, fan-in\u002Ffan-out, priority selects, for-select loops, nil-channel state machines.",[98,505,506,509,515],{},[116,507,508],{},"19",[116,510,511],{},[122,512,514],{"href":513},"\u002Fgo\u002F19-sync-package","sync Package",[116,516,517],{},"Mutex\u002FRWMutex internals, WaitGroup race-free usage, Once lazy init, Cond, Pool allocation reuse, Map.",[98,519,520,523,529],{},[116,521,522],{},"20",[116,524,525],{},[122,526,528],{"href":527},"\u002Fgo\u002F20-context","Context",[116,530,531,532,535,536,539],{},"Cancellation trees, deadlines, the ",[69,533,534],{},"cancel"," leak, request-scoped values, ",[69,537,538],{},"errgroup"," bounded concurrency.",[87,541,543],{"id":542},"part-iv-io-standard-library-production-engineering","Part IV — I\u002FO, Standard Library & Production Engineering",[92,545,546,556],{},[95,547,548],{},[98,549,550,552,554],{},[101,551,103],{},[101,553,106],{},[101,555,109],{},[111,557,558,583,620,645,667,689,706,730],{},[98,559,560,563,569],{},[116,561,562],{},"21",[116,564,565],{},[122,566,568],{"href":567},"\u002Fgo\u002F21-packages-and-modules","Packages & Modules",[116,570,571,572,575,576,579,580,169],{},"Module versioning (v2+ paths), ",[69,573,574],{},"internal\u002F"," enforcement, workspaces, ",[69,577,578],{},"replace"," directives, private modules, ",[69,581,582],{},"go.sum",[98,584,585,588,594],{},[116,586,587],{},"22",[116,589,590],{},[122,591,593],{"href":592},"\u002Fgo\u002F22-io-and-files","I\u002FO, Files & io Package",[116,595,596,162,599,602,603,132,606,609,610,162,613,616,617,169],{},[69,597,598],{},"io.Reader",[69,600,601],{},"Writer"," composition, ",[69,604,605],{},"io.Copy",[69,607,608],{},"bufio.Scanner",", file durability (",[69,611,612],{},"Sync",[69,614,615],{},"Close","), ",[69,618,619],{},"io.Pipe",[98,621,622,625,631],{},[116,623,624],{},"23",[116,626,627],{},[122,628,630],{"href":629},"\u002Fgo\u002F23-encoding","Encoding: JSON, CSV, gob",[116,632,633,634,637,638,641,642,169],{},"Struct tags, ",[69,635,636],{},"omitempty"," traps, streaming JSON, ",[69,639,640],{},"json.Number"," precision, custom marshalers, ",[69,643,644],{},"gob",[98,646,647,650,656],{},[116,648,649],{},"24",[116,651,652],{},[122,653,655],{"href":654},"\u002Fgo\u002F24-time-and-dates","Time & Dates",[116,657,658,659,662,663,666],{},"Monotonic vs wall clock, reference time format, ",[69,660,661],{},"=="," vs ",[69,664,665],{},"Equal",", time zones, tickers\u002Ftimers.",[98,668,669,672,678],{},[116,670,671],{},"25",[116,673,674],{},[122,675,677],{"href":676},"\u002Fgo\u002F25-testing-and-benchmarking","Testing & Benchmarking",[116,679,680,681,684,685,688],{},"Table-driven tests, ",[69,682,683],{},"t.Parallel",", benchmark allocation analysis, fuzzing, ",[69,686,687],{},"httptest",", coverage gating.",[98,690,691,694,700],{},[116,692,693],{},"26",[116,695,696],{},[122,697,699],{"href":698},"\u002Fgo\u002F26-concurrency-patterns","Concurrency Patterns",[116,701,702,703,705],{},"Worker pool, pipeline, fan-out\u002Ffan-in, ",[69,704,538],{},", semaphore, generator, graceful shutdown.",[98,707,708,711,717],{},[116,709,710],{},"27",[116,712,713],{},[122,714,716],{"href":715},"\u002Fgo\u002F27-profiling-and-performance","Profiling & Performance",[116,718,719,722,723,132,726,729],{},[69,720,721],{},"pprof"," CPU\u002Fheap\u002Fgoroutine, escape analysis, allocation reduction, ",[69,724,725],{},"strings.Builder",[69,727,728],{},"sync.Pool",", inlining.",[98,731,732,735,741],{},[116,733,734],{},"28",[116,736,737],{},[122,738,740],{"href":739},"\u002Fgo\u002F28-exercises-and-projects","Exercises & Project Ideas",[116,742,743],{},"From beginner to expert: generics, concurrency patterns, concurrent web crawler, graceful server, capstone task queue.",[19,745,747],{"id":746},"learning-path-suggestions","Learning Path Suggestions",[87,749,751],{"id":750},"if-youre-coming-from-pythonrubyjs","If you're coming from Python\u002FRuby\u002FJS",[15,753,754],{},"Go's static typing, explicit error handling, and value semantics are the big shifts. Read 03–05 (types, functions), 07 (slices — they're not Python lists), 15 (errors — no exceptions), and 16–20 (concurrency — goroutines\u002Fchannels are unique to Go).",[87,756,758],{"id":757},"if-youre-coming-from-ccrust","If you're coming from C\u002FC++\u002FRust",[15,760,761],{},"Go is simpler but has surprises: garbage collection (no manual memory management), goroutines (not OS threads), channels (not mutexes as default), and implicit interfaces. Read 10 (escape analysis), 12 (interfaces), 16–18 (concurrency), 27 (profiling — escape analysis is Go's answer to zero-cost abstractions).",[87,763,765],{"id":764},"if-youre-a-senior-engineer","If you're a senior engineer",[15,767,768],{},"Start with 01 (toolchain internals), 10 (escape analysis), 12 (interface nil trap), 15 (error wrapping chains), 16 (G-M-P scheduler), 20 (context cancellation trees), 26 (concurrency patterns), 27 (profiling). The exercises in 28 are production-graded.",[19,770,772],{"id":771},"what-makes-this-course-different","What Makes This Course Different",[63,774,775,781,787,793,799],{},[27,776,777,780],{},[30,778,779],{},"Code-first",": every concept is demonstrated with production-grade annotated code, not prose.",[27,782,783,786],{},[30,784,785],{},"Anti-patterns → fixes",": every chapter shows the wrong way, explains the trap, and gives the correct production pattern.",[27,788,789,792],{},[30,790,791],{},"Edge cases and gotchas",": each chapter includes subtle boundary conditions, compiler quirks, and runtime failure modes.",[27,794,795,798],{},[30,796,797],{},"Quick quizzes",": test understanding with tricky code snippets at the end of each chapter.",[27,800,801,804,805,807],{},[30,802,803],{},"Production focus",": Docker multi-stage builds, graceful shutdown, supply chain (",[69,806,582],{},"), race detection, profiling — not just syntax.",[19,809,811],{"id":810},"prerequisites-for-chapters","Prerequisites for Chapters",[92,813,814,824],{},[95,815,816],{},[98,817,818,821],{},[101,819,820],{},"Chapters",[101,822,823],{},"Requires",[111,825,826,834,842,849,857,865,873],{},[98,827,828,831],{},[116,829,830],{},"01–06",[116,832,833],{},"Nothing (start here if new to Go)",[98,835,836,839],{},[116,837,838],{},"07–14",[116,840,841],{},"01–06 (foundations)",[98,843,844,846],{},[116,845,434],{},[116,847,848],{},"05 (defer), 12 (nil interface)",[98,850,851,854],{},[116,852,853],{},"16–20",[116,855,856],{},"06 (control flow), 11 (methods)",[98,858,859,862],{},[116,860,861],{},"21–24",[116,863,864],{},"01 (modules), 04 (types)",[98,866,867,870],{},[116,868,869],{},"25–27",[116,871,872],{},"All prior chapters",[98,874,875,877],{},[116,876,734],{},[116,878,879],{},"All chapters (capstone exercises)",{"title":881,"searchDepth":882,"depth":882,"links":883},"",2,[884,885,886,893,898,899],{"id":21,"depth":882,"text":22},{"id":60,"depth":882,"text":61},{"id":84,"depth":882,"text":85,"children":887},[888,890,891,892],{"id":89,"depth":889,"text":90},3,{"id":251,"depth":889,"text":252},{"id":414,"depth":889,"text":415},{"id":542,"depth":889,"text":543},{"id":746,"depth":882,"text":747,"children":894},[895,896,897],{"id":750,"depth":889,"text":751},{"id":757,"depth":889,"text":758},{"id":764,"depth":889,"text":765},{"id":771,"depth":882,"text":772},{"id":810,"depth":882,"text":811},"A deep-dive, code-first Go engineering reference. 28 chapters covering toolchain internals, memory models, concurrency, profiling, and production patterns — built for mid-level developers moving to senior roles.","md",{},true,"\u002Fgo",{"title":5,"description":900},"go\u002Findex","8-XeVJ6OQZoeh0gYH7j6L0_tgtPoK8UZ1hNrtSwzfEY",1789924648824]