[{"data":1,"prerenderedAt":1268},["ShallowReactive",2],{"navigation_docs":3,"-getting-started-advanced-modules":377,"-getting-started-advanced-modules-surround":1263},[4,39,114,144,184,244,293,362],{"title":5,"icon":6,"path":7,"stem":8,"children":9,"page":6},"Getting Started",false,"\u002Fgetting-started","1.getting-started",[10,15,20,25,30,35],{"title":11,"path":12,"stem":13,"icon":14},"Learning Path","\u002Fgetting-started\u002Flearning-path","1.getting-started\u002F1.learning-path","i-lucide-map",{"title":16,"path":17,"stem":18,"icon":19},"Introduction","\u002Fgetting-started\u002Fintroduction","1.getting-started\u002F2.introduction","i-lucide-house",{"title":21,"path":22,"stem":23,"icon":24},"Installation","\u002Fgetting-started\u002Finstallation","1.getting-started\u002F3.installation","i-lucide-download",{"title":26,"path":27,"stem":28,"icon":29},"Your First Program","\u002Fgetting-started\u002Ffirst-program","1.getting-started\u002F4.first-program","i-lucide-play",{"title":31,"path":32,"stem":33,"icon":34},"Modules and Dependencies","\u002Fgetting-started\u002Fmodules-and-dependencies","1.getting-started\u002F5.modules-and-dependencies","i-lucide-package-open",{"title":36,"path":37,"stem":38,"icon":34},"Advanced Modules","\u002Fgetting-started\u002Fadvanced-modules","1.getting-started\u002F6.advanced-modules",{"title":40,"path":41,"stem":42,"children":43,"page":6},"Fundamentals","\u002Ffundamentals","2.fundamentals",[44,49,54,59,64,69,74,79,84,89,94,99,104,109],{"title":45,"path":46,"stem":47,"icon":48},"Program Structure","\u002Ffundamentals\u002Fprogram-structure","2.fundamentals\u002F1.program-structure","i-lucide-workflow",{"title":50,"path":51,"stem":52,"icon":53},"Structs and Methods","\u002Ffundamentals\u002Fstructs-and-methods","2.fundamentals\u002F10.structs-and-methods","i-lucide-box",{"title":55,"path":56,"stem":57,"icon":58},"Interfaces","\u002Ffundamentals\u002Finterfaces","2.fundamentals\u002F11.interfaces","i-lucide-plug",{"title":60,"path":61,"stem":62,"icon":63},"Error Handling","\u002Ffundamentals\u002Ferrors","2.fundamentals\u002F12.errors","i-lucide-triangle-alert",{"title":65,"path":66,"stem":67,"icon":68},"Defined Types and Type Aliases","\u002Ffundamentals\u002Fdefined-types","2.fundamentals\u002F13.defined-types","i-lucide-tags",{"title":70,"path":71,"stem":72,"icon":73},"Generics","\u002Ffundamentals\u002Fgenerics","2.fundamentals\u002F14.generics","i-lucide-blocks",{"title":75,"path":76,"stem":77,"icon":78},"Project Structure","\u002Ffundamentals\u002Fproject-structure","2.fundamentals\u002F2.project-structure","i-lucide-folder-tree",{"title":80,"path":81,"stem":82,"icon":83},"Project Layout","\u002Ffundamentals\u002Fproject-layout","2.fundamentals\u002F3.project-layout","i-lucide-layout",{"title":85,"path":86,"stem":87,"icon":88},"Variables and Data Types","\u002Ffundamentals\u002Fvariables-and-types","2.fundamentals\u002F4.variables-and-types","i-lucide-variable",{"title":90,"path":91,"stem":92,"icon":93},"Functions","\u002Ffundamentals\u002Ffunctions","2.fundamentals\u002F5.functions","i-lucide-braces",{"title":95,"path":96,"stem":97,"icon":98},"Control Statements","\u002Ffundamentals\u002Fcontrol-statements","2.fundamentals\u002F6.control-statements","i-lucide-git-branch",{"title":100,"path":101,"stem":102,"icon":103},"Pointers","\u002Ffundamentals\u002Fpointers","2.fundamentals\u002F7.pointers","i-lucide-mouse-pointer-2",{"title":105,"path":106,"stem":107,"icon":108},"Arrays and Slices","\u002Ffundamentals\u002Farrays-and-slices","2.fundamentals\u002F8.arrays-and-slices","i-lucide-list",{"title":110,"path":111,"stem":112,"icon":113},"Maps","\u002Ffundamentals\u002Fmaps","2.fundamentals\u002F9.maps","i-lucide-table-properties",{"title":115,"path":116,"stem":117,"children":118,"page":6},"Concurrency","\u002Fconcurrency","3.concurrency",[119,124,129,134,139],{"title":120,"path":121,"stem":122,"icon":123},"Concurrency Model","\u002Fconcurrency\u002Fconcurrency-model","3.concurrency\u002F1.concurrency-model","i-lucide-network",{"title":125,"path":126,"stem":127,"icon":128},"Goroutines","\u002Fconcurrency\u002Fgoroutines","3.concurrency\u002F2.goroutines","i-lucide-git-fork",{"title":130,"path":131,"stem":132,"icon":133},"Channels","\u002Fconcurrency\u002Fchannels","3.concurrency\u002F3.channels","i-lucide-arrow-left-right",{"title":135,"path":136,"stem":137,"icon":138},"Select and Cancellation","\u002Fconcurrency\u002Fselect-and-cancellation","3.concurrency\u002F4.select-and-cancellation","i-lucide-circle-stop",{"title":140,"path":141,"stem":142,"icon":143},"Synchronization","\u002Fconcurrency\u002Fsynchronization","3.concurrency\u002F5.synchronization","i-lucide-lock-keyhole",{"title":145,"path":146,"stem":147,"children":148,"page":6},"Standard Library","\u002Fstandard-library","4.standard-library",[149,154,159,164,169,174,179],{"title":150,"path":151,"stem":152,"icon":153},"Standard Library Overview","\u002Fstandard-library\u002Foverview","4.standard-library\u002F1.overview","i-lucide-library",{"title":155,"path":156,"stem":157,"icon":158},"Text and Formatting","\u002Fstandard-library\u002Ftext-and-formatting","4.standard-library\u002F2.text-and-formatting","i-lucide-text",{"title":160,"path":161,"stem":162,"icon":163},"Files and JSON","\u002Fstandard-library\u002Ffiles-and-json","4.standard-library\u002F3.files-and-json","i-lucide-file-json",{"title":165,"path":166,"stem":167,"icon":168},"HTTP Clients and Servers","\u002Fstandard-library\u002Fhttp","4.standard-library\u002F4.http","i-lucide-server",{"title":170,"path":171,"stem":172,"icon":173},"Testing","\u002Fstandard-library\u002Ftesting","4.standard-library\u002F5.testing","i-lucide-flask-conical",{"title":175,"path":176,"stem":177,"icon":178},"Command-Line Tools and Configuration","\u002Fstandard-library\u002Fcommand-line-and-configuration","4.standard-library\u002F6.command-line-and-configuration","i-lucide-terminal-square",{"title":180,"path":181,"stem":182,"icon":183},"Structured Logging","\u002Fstandard-library\u002Fstructured-logging","4.standard-library\u002F7.structured-logging","i-lucide-scroll-text",{"title":185,"path":186,"stem":187,"children":188,"page":6},"Backend Development","\u002Fbackend-development","5.backend-development",[189,194,199,204,209,214,219,224,229,234,239],{"title":190,"path":191,"stem":192,"icon":193},"Backend Roadmap","\u002Fbackend-development\u002Fbackend-roadmap","5.backend-development\u002F1.backend-roadmap","i-lucide-route",{"title":195,"path":196,"stem":197,"icon":198},"Graceful Shutdown","\u002Fbackend-development\u002Fgraceful-shutdown","5.backend-development\u002F10.graceful-shutdown","i-lucide-power",{"title":200,"path":201,"stem":202,"icon":203},"Production Checklist","\u002Fbackend-development\u002Fproduction-checklist","5.backend-development\u002F11.production-checklist","i-lucide-clipboard-check",{"title":205,"path":206,"stem":207,"icon":208},"HTTP API Design","\u002Fbackend-development\u002Fhttp-api-design","5.backend-development\u002F2.http-api-design","i-lucide-waypoints",{"title":210,"path":211,"stem":212,"icon":213},"Middleware","\u002Fbackend-development\u002Fmiddleware","5.backend-development\u002F3.middleware","i-lucide-layers-3",{"title":215,"path":216,"stem":217,"icon":218},"Validation","\u002Fbackend-development\u002Fvalidation","5.backend-development\u002F4.validation","i-lucide-list-checks",{"title":220,"path":221,"stem":222,"icon":223},"Application Wiring","\u002Fbackend-development\u002Fapplication-wiring","5.backend-development\u002F5.application-wiring","i-lucide-cable",{"title":225,"path":226,"stem":227,"icon":228},"Observability","\u002Fbackend-development\u002Fobservability","5.backend-development\u002F6.observability","i-lucide-activity",{"title":230,"path":231,"stem":232,"icon":233},"Database SQL","\u002Fbackend-development\u002Fdatabase-sql","5.backend-development\u002F7.database-sql","i-lucide-database",{"title":235,"path":236,"stem":237,"icon":238},"Transactions","\u002Fbackend-development\u002Ftransactions","5.backend-development\u002F8.transactions","i-lucide-repeat-2",{"title":240,"path":241,"stem":242,"icon":243},"Authentication and Authorization","\u002Fbackend-development\u002Fauthentication","5.backend-development\u002F9.authentication","i-lucide-shield-check",{"title":245,"path":246,"stem":247,"children":248,"page":6},"Advanced Go","\u002Fadvanced-go","6.advanced-go",[249,254,259,264,269,274,278,283,288],{"title":250,"path":251,"stem":252,"icon":253},"Advanced Go Roadmap","\u002Fadvanced-go\u002Fadvanced-roadmap","6.advanced-go\u002F1.advanced-roadmap","i-lucide-brain-circuit",{"title":255,"path":256,"stem":257,"icon":258},"Reflection","\u002Fadvanced-go\u002Freflection","6.advanced-go\u002F2.reflection","i-lucide-scan-search",{"title":260,"path":261,"stem":262,"icon":263},"Memory and Garbage Collection","\u002Fadvanced-go\u002Fmemory-and-garbage-collection","6.advanced-go\u002F3.memory-and-garbage-collection","i-lucide-memory-stick",{"title":265,"path":266,"stem":267,"icon":268},"Benchmarking and Profiling","\u002Fadvanced-go\u002Fbenchmarking-and-profiling","6.advanced-go\u002F4.benchmarking-and-profiling","i-lucide-gauge",{"title":270,"path":271,"stem":272,"icon":273},"Advanced Testing and Fuzzing","\u002Fadvanced-go\u002Fadvanced-testing-and-fuzzing","6.advanced-go\u002F5.advanced-testing-and-fuzzing","i-lucide-microscope",{"title":275,"path":276,"stem":277,"icon":48},"Advanced Concurrency","\u002Fadvanced-go\u002Fadvanced-concurrency","6.advanced-go\u002F6.advanced-concurrency",{"title":279,"path":280,"stem":281,"icon":282},"Unsafe and C Boundaries","\u002Fadvanced-go\u002Funsafe-and-cgo","6.advanced-go\u002F7.unsafe-and-cgo","i-lucide-radiation",{"title":284,"path":285,"stem":286,"icon":287},"Package and API Design","\u002Fadvanced-go\u002Fpackage-and-api-design","6.advanced-go\u002F8.package-and-api-design","i-lucide-boxes",{"title":289,"path":290,"stem":291,"icon":292},"Distributed Reliability","\u002Fadvanced-go\u002Fdistributed-reliability","6.advanced-go\u002F9.distributed-reliability","i-lucide-cloud-cog",{"title":294,"path":295,"stem":296,"children":297,"page":6},"Projects","\u002Fprojects","7.projects",[298,316,332,347],{"title":299,"path":300,"stem":301,"children":302,"icon":305},"CLI Task Manager","\u002Fprojects\u002Fcli-task-manager","7.projects\u002F1.cli-task-manager\u002Findex",[303,306,311],{"title":304,"path":300,"stem":301,"icon":305},"Project — CLI Task Manager","i-lucide-list-todo",{"title":307,"path":308,"stem":309,"icon":310},"CLI — Domain and Storage","\u002Fprojects\u002Fcli-task-manager\u002Fdomain-and-storage","7.projects\u002F1.cli-task-manager\u002F1.domain-and-storage","i-lucide-save",{"title":312,"path":313,"stem":314,"icon":315},"CLI — Commands and Tests","\u002Fprojects\u002Fcli-task-manager\u002Fcommands-and-tests","7.projects\u002F1.cli-task-manager\u002F2.commands-and-tests","i-lucide-terminal",{"title":317,"path":318,"stem":319,"children":320,"icon":323},"Concurrent URL Checker","\u002Fprojects\u002Fconcurrent-url-checker","7.projects\u002F2.concurrent-url-checker\u002Findex",[321,324,328],{"title":322,"path":318,"stem":319,"icon":323},"Project — Concurrent URL Checker","i-lucide-radar",{"title":325,"path":326,"stem":327,"icon":128},"URL Checker — Worker Pipeline","\u002Fprojects\u002Fconcurrent-url-checker\u002Fworker-pipeline","7.projects\u002F2.concurrent-url-checker\u002F1.worker-pipeline",{"title":329,"path":330,"stem":331,"icon":173},"URL Checker — Cancellation and Tests","\u002Fprojects\u002Fconcurrent-url-checker\u002Fcancellation-and-tests","7.projects\u002F2.concurrent-url-checker\u002F2.cancellation-and-tests",{"title":333,"path":334,"stem":335,"children":336},"File-backed API","\u002Fprojects\u002Ffile-backed-api","7.projects\u002F3.file-backed-api\u002Findex",[337,339,343],{"title":338,"path":334,"stem":335},"File-backed notes API",{"title":340,"path":341,"stem":342},"File store and concurrency","\u002Fprojects\u002Ffile-backed-api\u002Ffile-store-and-concurrency","7.projects\u002F3.file-backed-api\u002F1.file-store-and-concurrency",{"title":344,"path":345,"stem":346},"HTTP layer and tests","\u002Fprojects\u002Ffile-backed-api\u002Fhttp-and-tests","7.projects\u002F3.file-backed-api\u002F2.http-and-tests",{"title":348,"path":349,"stem":350,"children":351},"Production REST API","\u002Fprojects\u002Fproduction-rest-api","7.projects\u002F4.production-rest-api\u002Findex",[352,354,358],{"title":353,"path":349,"stem":350},"Production REST API capstone",{"title":355,"path":356,"stem":357},"Persistence and authentication","\u002Fprojects\u002Fproduction-rest-api\u002Fpersistence-and-auth","7.projects\u002F4.production-rest-api\u002F1.persistence-and-auth",{"title":359,"path":360,"stem":361},"Operations and release","\u002Fprojects\u002Fproduction-rest-api\u002Foperations-and-release","7.projects\u002F4.production-rest-api\u002F2.operations-and-release",{"title":363,"path":364,"stem":365,"children":366,"page":6},"Meta","\u002Fmeta","99.meta",[367,372],{"title":368,"path":369,"stem":370,"icon":371},"About","\u002Fmeta\u002Fabout","99.meta\u002F1.about","i-lucide-info",{"title":373,"path":374,"stem":375,"icon":376},"Acknowledgements","\u002Fmeta\u002Facknowledgements","99.meta\u002F2.acknowledgements","i-lucide-heart-handshake",{"id":378,"title":36,"body":379,"description":1255,"extension":1256,"links":1257,"meta":1258,"navigation":1259,"path":37,"seo":1260,"stem":38,"__hash__":1262},"docs\u002F1.getting-started\u002F6.advanced-modules.md",{"type":380,"value":381,"toc":1240},"minimark",[382,389,394,414,418,424,506,524,528,547,556,560,567,594,615,619,626,634,647,654,659,695,702,706,716,742,755,759,769,773,818,840,844,887,891,909,1197,1201,1215,1230,1233,1236],[383,384],"learning-lesson-meta",{"description":385,"difficulty":386,"prerequisites":387,"time":388},"Handle major versions, local multi-module development, internal packages, and safe dependency updates.","Intermediate","Modules and Dependencies, Packages and Visibility","40 minutes",[390,391,393],"h2",{"id":392},"what-you-will-learn","What you will learn",[395,396,397,398,402,403,402,406,409,410,413],"p",{},"The beginner lesson covered ",[399,400,401],"code",{},"go.mod",", ",[399,404,405],{},"go.sum",[399,407,408],{},"go mod tidy",", and ",[399,411,412],{},"go get",". This lesson covers what you need once projects grow: how Go handles major versions, how to work on several modules at once, how to hide packages, and how to update dependencies without surprises.",[390,415,417],{"id":416},"direct-and-indirect-requirements","Direct and indirect requirements",[395,419,420,421,423],{},"Open a ",[399,422,401],{}," that has a few dependencies:",[425,426,431],"pre",{"className":427,"code":428,"filename":401,"language":429,"meta":430,"style":430},"language-go shiki shiki-themes solarized-light material-theme one-dark-pro","require (\n    example.com\u002Fdirect v1.2.0\n    example.com\u002Ftransitive v0.9.1 \u002F\u002F indirect\n)\n","go","",[399,432,433,446,474,500],{"__ignoreMap":430},[434,435,438,442],"span",{"class":436,"line":437},"line",1,[434,439,441],{"class":440},"s45-6","require",[434,443,445],{"class":444},"shFME"," (\n",[434,447,449,452,455,458,462,465,468,470],{"class":436,"line":448},2,[434,450,451],{"class":440},"    example",[434,453,454],{"class":444},".",[434,456,457],{"class":440},"com",[434,459,461],{"class":460},"sEOdo","\u002F",[434,463,464],{"class":440},"direct",[434,466,467],{"class":440}," v1",[434,469,454],{"class":444},[434,471,473],{"class":472},"sAJzr","2.0\n",[434,475,477,479,481,483,485,488,491,493,496],{"class":436,"line":476},3,[434,478,451],{"class":440},[434,480,454],{"class":444},[434,482,457],{"class":440},[434,484,461],{"class":460},[434,486,487],{"class":440},"transitive",[434,489,490],{"class":440}," v0",[434,492,454],{"class":444},[434,494,495],{"class":472},"9.1",[434,497,499],{"class":498},"sJsHy"," \u002F\u002F indirect\n",[434,501,503],{"class":436,"line":502},4,[434,504,505],{"class":444},")\n",[395,507,508,509,512,513,516,517,520,521,523],{},"A ",[510,511,464],"strong",{}," requirement provides a package your own code imports. An ",[510,514,515],{},"indirect"," requirement is a dependency of a dependency that Go needs to record for the build. The ",[399,518,519],{},"\u002F\u002F indirect"," comment is added by ",[399,522,408],{},", not by you.",[390,525,527],{"id":526},"minimum-version-selection","Minimum version selection",[395,529,530,531,534,535,538,539,542,543,546],{},"If your project needs ",[399,532,533],{},"A v1.2.0"," and another dependency needs ",[399,536,537],{},"A v1.4.0",", Go picks ",[399,540,541],{},"v1.4.0",": the ",[510,544,545],{},"highest of the minimum versions"," requested anywhere in the graph. It does not jump to the newest release available. This makes builds predictable, because adding a dependency never silently upgrades unrelated ones.",[395,548,549,550,552,553,555],{},"It also explains why ",[399,551,412],{}," can change several lines in ",[399,554,401],{},". Raising one module can raise others it requires, so always review the diff.",[390,557,559],{"id":558},"major-versions","Major versions",[395,561,562,563,566],{},"Go uses ",[510,564,565],{},"semantic import versioning",". From version 2 onward, the major version is part of the module path:",[425,568,570],{"className":427,"code":569,"filename":401,"language":429,"meta":430,"style":430},"module example.com\u002Ftoolkit\u002Fv2\n",[399,571,572],{"__ignoreMap":430},[434,573,574,577,580,582,584,586,589,591],{"class":436,"line":437},[434,575,576],{"class":440},"module",[434,578,579],{"class":440}," example",[434,581,454],{"class":444},[434,583,457],{"class":440},[434,585,461],{"class":460},[434,587,588],{"class":440},"toolkit",[434,590,461],{"class":460},[434,592,593],{"class":440},"v2\n",[395,595,596,597,600,601,604,605,608,609,604,612,614],{},"Callers import ",[399,598,599],{},"example.com\u002Ftoolkit\u002Fv2\u002Fparser",". Because ",[399,602,603],{},"v1"," and ",[399,606,607],{},"v2"," have different paths, both can exist in the same build, which lets you migrate gradually. Versions ",[399,610,611],{},"v0",[399,613,603],{}," do not add a suffix.",[390,616,618],{"id":617},"internal-packages","Internal packages",[395,620,621,622,625],{},"A package inside a folder named ",[399,623,624],{},"internal"," can only be imported by code rooted at that folder's parent:",[425,627,632],{"className":628,"code":630,"language":631,"meta":430},[629],"language-text","tasker\u002F\n├── go.mod\n├── cmd\u002Ftasker\u002Fmain.go\n└── internal\u002Ftask\u002Ftask.go\n","text",[399,633,630],{"__ignoreMap":430},[395,635,636,639,640,643,644,646],{},[399,637,638],{},"cmd\u002Ftasker\u002Fmain.go"," can import ",[399,641,642],{},"example.com\u002Flearner\u002Ftasker\u002Finternal\u002Ftask",". Code in a different module cannot, and the toolchain rejects the import. Use ",[399,645,624],{}," for code you do not want to promise as a public API.",[390,648,650,651],{"id":649},"local-development-with-replace","Local development with ",[399,652,653],{},"replace",[395,655,508,656,658],{},[399,657,653],{}," directive points a module path at a folder on your machine:",[425,660,662],{"className":427,"code":661,"filename":401,"language":429,"meta":430,"style":430},"replace example.com\u002Fshared => ..\u002Fshared\n",[399,663,664],{"__ignoreMap":430},[434,665,666,668,670,672,674,676,679,683,687,690,692],{"class":436,"line":437},[434,667,653],{"class":440},[434,669,579],{"class":440},[434,671,454],{"class":444},[434,673,457],{"class":440},[434,675,461],{"class":460},[434,677,678],{"class":440},"shared",[434,680,682],{"class":681},"su2KV"," =",[434,684,686],{"class":685},"sRBoR",">",[434,688,689],{"class":444}," ..",[434,691,461],{"class":460},[434,693,694],{"class":440},"shared\n",[395,696,697,698,701],{},"This is useful while fixing a library and testing it in an app at the same time. It is dangerous to publish: other people do not have ",[399,699,700],{},"..\u002Fshared",". Remove it before you release, or use a workspace instead.",[390,703,705],{"id":704},"workspaces","Workspaces",[395,707,708,709,712,713,715],{},"For coordinated work across several local modules, a ",[510,710,711],{},"workspace"," is cleaner than editing ",[399,714,401],{},":",[425,717,722],{"className":718,"code":719,"filename":720,"language":721,"meta":430,"style":430},"language-bash shiki shiki-themes solarized-light material-theme one-dark-pro","go work init .\u002Fservice .\u002Fshared\n","Terminal","bash",[399,723,724],{"__ignoreMap":430},[434,725,726,729,733,736,739],{"class":436,"line":437},[434,727,429],{"class":728},"sqRHY",[434,730,732],{"class":731},"sVazx"," work",[434,734,735],{"class":731}," init",[434,737,738],{"class":731}," .\u002Fservice",[434,740,741],{"class":731}," .\u002Fshared\n",[395,743,744,745,748,749,751,752,754],{},"This creates a ",[399,746,747],{},"go.work"," file that tells Go to use the local copies of both modules. Your ",[399,750,401],{}," files stay untouched. Decide deliberately whether to commit ",[399,753,747],{},". Many teams keep it out of version control because it describes one person's local layout.",[390,756,758],{"id":757},"vendoring","Vendoring",[395,760,761,764,765,768],{},[399,762,763],{},"go mod vendor"," copies all dependencies into a ",[399,766,767],{},"vendor\u002F"," folder in your project. It is an explicit workflow for builds that must work offline or for strict review policies. Most projects do not need it, and it never happens automatically.",[390,770,772],{"id":771},"a-safe-update-workflow","A safe update workflow",[774,775,776,780,783,800,808,815],"ol",{},[777,778,779],"li",{},"Read the release notes and any migration guide.",[777,781,782],{},"Update one logical group of modules at a time.",[777,784,785,786,402,789,409,792,795,796,799],{},"Run ",[399,787,788],{},"go fmt .\u002F...",[399,790,791],{},"go vet .\u002F...",[399,793,794],{},"go test .\u002F...",". Add ",[399,797,798],{},"-race"," where concurrency is involved.",[777,801,802,803,604,805,807],{},"Review the ",[399,804,401],{},[399,806,405],{}," diff.",[777,809,810,811,814],{},"Scan for known vulnerabilities with ",[399,812,813],{},"govulncheck",", which reports only vulnerabilities in code your program actually reaches.",[777,816,817],{},"Commit with a message that explains why, so a future maintainer can revert safely.",[425,819,821],{"className":718,"code":820,"filename":720,"language":721,"meta":430,"style":430},"go install golang.org\u002Fx\u002Fvuln\u002Fcmd\u002Fgovulncheck@latest\ngovulncheck .\u002F...\n",[399,822,823,833],{"__ignoreMap":430},[434,824,825,827,830],{"class":436,"line":437},[434,826,429],{"class":728},[434,828,829],{"class":731}," install",[434,831,832],{"class":731}," golang.org\u002Fx\u002Fvuln\u002Fcmd\u002Fgovulncheck@latest\n",[434,834,835,837],{"class":436,"line":448},[434,836,813],{"class":728},[434,838,839],{"class":731}," .\u002F...\n",[390,841,843],{"id":842},"common-mistakes","Common mistakes",[845,846,847,856,869,878],"ul",{},[777,848,849,855],{},[510,850,851,852,854],{},"Committing a ",[399,853,653],{}," that points at a local path."," Everyone else's build breaks.",[777,857,858,868],{},[510,859,860,861,864,865,867],{},"Importing ",[399,862,863],{},"\u002Fv2"," code without the ",[399,866,863],{}," suffix."," You will silently get the old major version.",[777,870,871,877],{},[510,872,873,874,876],{},"Importing an ",[399,875,624],{}," package from outside its allowed tree."," The toolchain rejects it by design.",[777,879,880,886],{},[510,881,882,883,885],{},"Assuming ",[399,884,767],{}," is used automatically."," It is an explicit choice.",[390,888,890],{"id":889},"practice","Practice",[395,892,893,894,604,897,899,900,902,903,905,906,908],{},"Create two modules, ",[399,895,896],{},"app",[399,898,678],{},", in sibling folders. Make ",[399,901,896],{}," import a function from ",[399,904,678],{},", and run it without publishing ",[399,907,678],{}," anywhere. Use a workspace.",[910,911,912],"accordion",{},[913,914,917,997,1053,1148,1182],"accordion-item",{"icon":915,"label":916},"i-lucide-lightbulb","Show solution",[425,918,920],{"className":718,"code":919,"filename":720,"language":721,"meta":430,"style":430},"mkdir workspace && cd workspace\nmkdir app shared\n(cd shared && go mod init example.com\u002Fshared)\n(cd app && go mod init example.com\u002Fapp)\n",[399,921,922,940,950,976],{"__ignoreMap":430},[434,923,924,927,930,933,937],{"class":436,"line":437},[434,925,926],{"class":728},"mkdir",[434,928,929],{"class":731}," workspace",[434,931,932],{"class":444}," &&",[434,934,936],{"class":935},"sTZgv"," cd",[434,938,939],{"class":731}," workspace\n",[434,941,942,944,947],{"class":436,"line":448},[434,943,926],{"class":728},[434,945,946],{"class":731}," app",[434,948,949],{"class":731}," shared\n",[434,951,952,955,958,961,963,966,969,971,974],{"class":436,"line":476},[434,953,954],{"class":444},"(",[434,956,957],{"class":935},"cd",[434,959,960],{"class":731}," shared",[434,962,932],{"class":444},[434,964,965],{"class":728}," go",[434,967,968],{"class":731}," mod",[434,970,735],{"class":731},[434,972,973],{"class":731}," example.com\u002Fshared",[434,975,505],{"class":444},[434,977,978,980,982,984,986,988,990,992,995],{"class":436,"line":502},[434,979,954],{"class":444},[434,981,957],{"class":935},[434,983,946],{"class":731},[434,985,932],{"class":444},[434,987,965],{"class":728},[434,989,968],{"class":731},[434,991,735],{"class":731},[434,993,994],{"class":731}," example.com\u002Fapp",[434,996,505],{"class":444},[425,998,1001],{"className":427,"code":999,"filename":1000,"language":429,"meta":430,"style":430},"package shared\n\nfunc Greet() string { return \"hello from shared\" }\n","shared\u002Fshared.go",[399,1002,1003,1011,1017],{"__ignoreMap":430},[434,1004,1005,1008],{"class":436,"line":437},[434,1006,1007],{"class":460},"package",[434,1009,949],{"class":1010},"snwKR",[434,1012,1013],{"class":436,"line":448},[434,1014,1016],{"emptyLinePlaceholder":1015},true,"\n",[434,1018,1019,1022,1026,1029,1033,1036,1040,1044,1047,1050],{"class":436,"line":476},[434,1020,1021],{"class":460},"func",[434,1023,1025],{"class":1024},"sisdC"," Greet",[434,1027,1028],{"class":444},"()",[434,1030,1032],{"class":1031},"sF6sA"," string",[434,1034,1035],{"class":444}," {",[434,1037,1039],{"class":1038},"s7Bcg"," return",[434,1041,1043],{"class":1042},"sED5a"," \"",[434,1045,1046],{"class":731},"hello from shared",[434,1048,1049],{"class":1042},"\"",[434,1051,1052],{"class":444}," }\n",[425,1054,1057],{"className":427,"code":1055,"filename":1056,"language":429,"meta":430,"style":430},"package main\n\nimport (\n    \"fmt\"\n\n    \"example.com\u002Fshared\"\n)\n\nfunc main() { fmt.Println(shared.Greet()) }\n","app\u002Fmain.go",[399,1058,1059,1066,1070,1077,1089,1094,1104,1109,1114],{"__ignoreMap":430},[434,1060,1061,1063],{"class":436,"line":437},[434,1062,1007],{"class":460},[434,1064,1065],{"class":1010}," main\n",[434,1067,1068],{"class":436,"line":448},[434,1069,1016],{"emptyLinePlaceholder":1015},[434,1071,1072,1075],{"class":436,"line":476},[434,1073,1074],{"class":1038},"import",[434,1076,445],{"class":444},[434,1078,1079,1082,1086],{"class":436,"line":502},[434,1080,1081],{"class":1042},"    \"",[434,1083,1085],{"class":1084},"sdLNw","fmt",[434,1087,1088],{"class":1042},"\"\n",[434,1090,1092],{"class":436,"line":1091},5,[434,1093,1016],{"emptyLinePlaceholder":1015},[434,1095,1097,1099,1102],{"class":436,"line":1096},6,[434,1098,1081],{"class":1042},[434,1100,1101],{"class":1084},"example.com\u002Fshared",[434,1103,1088],{"class":1042},[434,1105,1107],{"class":436,"line":1106},7,[434,1108,505],{"class":444},[434,1110,1112],{"class":436,"line":1111},8,[434,1113,1016],{"emptyLinePlaceholder":1015},[434,1115,1117,1119,1122,1124,1126,1129,1131,1134,1136,1138,1140,1143,1146],{"class":436,"line":1116},9,[434,1118,1021],{"class":460},[434,1120,1121],{"class":1024}," main",[434,1123,1028],{"class":444},[434,1125,1035],{"class":444},[434,1127,1128],{"class":440}," fmt",[434,1130,454],{"class":444},[434,1132,1133],{"class":1024},"Println",[434,1135,954],{"class":444},[434,1137,678],{"class":440},[434,1139,454],{"class":444},[434,1141,1142],{"class":1024},"Greet",[434,1144,1145],{"class":444},"())",[434,1147,1052],{"class":444},[425,1149,1151],{"className":718,"code":1150,"filename":720,"language":721,"meta":430,"style":430},"go work init .\u002Fapp .\u002Fshared\ncd app && go run .\n",[399,1152,1153,1166],{"__ignoreMap":430},[434,1154,1155,1157,1159,1161,1164],{"class":436,"line":437},[434,1156,429],{"class":728},[434,1158,732],{"class":731},[434,1160,735],{"class":731},[434,1162,1163],{"class":731}," .\u002Fapp",[434,1165,741],{"class":731},[434,1167,1168,1170,1172,1174,1176,1179],{"class":436,"line":448},[434,1169,957],{"class":935},[434,1171,946],{"class":731},[434,1173,932],{"class":444},[434,1175,965],{"class":728},[434,1177,1178],{"class":731}," run",[434,1180,1181],{"class":731}," .\n",[395,1183,1184,1185,1187,1188,1190,1191,1193,1194,1196],{},"The workspace makes Go use the local ",[399,1186,678],{}," folder for the ",[399,1189,1101],{}," import, so no ",[399,1192,653],{}," directive and no published module is needed. Neither ",[399,1195,401],{}," file was changed.",[390,1198,1200],{"id":1199},"summary","Summary",[395,1202,1203,1204,1206,1207,1209,1210,1212,1213,454],{},"Direct requirements come from your imports, while indirect ones are dependencies of dependencies. Minimum version selection picks the highest minimum version requested in the graph. From v2 onward the major version is part of the import path. Use ",[399,1205,624],{}," to hide packages, ",[399,1208,747],{}," for local multi-module work, and avoid committing ",[399,1211,653],{}," paths. Update dependencies one group at a time, verify with tests, and scan with ",[399,1214,813],{},[395,1216,1217,1218,604,1225,454],{},"Official references: ",[1219,1220,1224],"a",{"href":1221,"rel":1222},"https:\u002F\u002Fgo.dev\u002Fref\u002Fmod",[1223],"nofollow","Go Modules Reference",[1219,1226,1229],{"href":1227,"rel":1228},"https:\u002F\u002Fgo.dev\u002Fdoc\u002Ftutorial\u002Fworkspaces",[1223],"Tutorial: Getting started with multi-module workspaces",[1231,1232],"learning-lesson-complete",{},[1234,1235],"learning-lesson-navigation",{"previous":32,"previousTitle":31},[1237,1238,1239],"style",{},"html pre.shiki code .s45-6, html code.shiki .s45-6{--shiki-light:#268BD2;--shiki-default:#EEFFFF;--shiki-dark:#E06C75}html pre.shiki code .shFME, html code.shiki .shFME{--shiki-light:#657B83;--shiki-default:#89DDFF;--shiki-dark:#ABB2BF}html pre.shiki code .sEOdo, html code.shiki .sEOdo{--shiki-light:#859900;--shiki-default:#89DDFF;--shiki-dark:#C678DD}html pre.shiki code .sAJzr, html code.shiki .sAJzr{--shiki-light:#D33682;--shiki-default:#F78C6C;--shiki-dark:#D19A66}html pre.shiki code .sJsHy, html code.shiki .sJsHy{--shiki-light:#93A1A1;--shiki-light-font-style:italic;--shiki-default:#546E7A;--shiki-default-font-style:italic;--shiki-dark:#7F848E;--shiki-dark-font-style:italic}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .su2KV, html code.shiki .su2KV{--shiki-light:#859900;--shiki-default:#89DDFF;--shiki-dark:#E5C07B}html pre.shiki code .sRBoR, html code.shiki .sRBoR{--shiki-light:#859900;--shiki-default:#89DDFF;--shiki-dark:#56B6C2}html pre.shiki code .sqRHY, html code.shiki .sqRHY{--shiki-light:#268BD2;--shiki-default:#FFCB6B;--shiki-dark:#61AFEF}html pre.shiki code .sVazx, html code.shiki .sVazx{--shiki-light:#2AA198;--shiki-default:#C3E88D;--shiki-dark:#98C379}html pre.shiki code .sTZgv, html code.shiki .sTZgv{--shiki-light:#268BD2;--shiki-default:#82AAFF;--shiki-dark:#56B6C2}html pre.shiki code .snwKR, html code.shiki .snwKR{--shiki-light:#CB4B16;--shiki-default:#FFCB6B;--shiki-dark:#E5C07B}html pre.shiki code .sisdC, html code.shiki .sisdC{--shiki-light:#268BD2;--shiki-default:#82AAFF;--shiki-dark:#61AFEF}html pre.shiki code .sF6sA, html code.shiki .sF6sA{--shiki-light:#586E75;--shiki-light-font-weight:bold;--shiki-default:#C792EA;--shiki-default-font-weight:inherit;--shiki-dark:#C678DD;--shiki-dark-font-weight:inherit}html pre.shiki code .s7Bcg, html code.shiki .s7Bcg{--shiki-light:#859900;--shiki-light-font-style:inherit;--shiki-default:#89DDFF;--shiki-default-font-style:italic;--shiki-dark:#C678DD;--shiki-dark-font-style:inherit}html pre.shiki code .sED5a, html code.shiki .sED5a{--shiki-light:#2AA198;--shiki-default:#89DDFF;--shiki-dark:#98C379}html pre.shiki code .sdLNw, html code.shiki .sdLNw{--shiki-light:#2AA198;--shiki-default:#FFCB6B;--shiki-dark:#98C379}",{"title":430,"searchDepth":448,"depth":448,"links":1241},[1242,1243,1244,1245,1246,1247,1249,1250,1251,1252,1253,1254],{"id":392,"depth":448,"text":393},{"id":416,"depth":448,"text":417},{"id":526,"depth":448,"text":527},{"id":558,"depth":448,"text":559},{"id":617,"depth":448,"text":618},{"id":649,"depth":448,"text":1248},"Local development with replace",{"id":704,"depth":448,"text":705},{"id":757,"depth":448,"text":758},{"id":771,"depth":448,"text":772},{"id":842,"depth":448,"text":843},{"id":889,"depth":448,"text":890},{"id":1199,"depth":448,"text":1200},"Major versions, indirect requirements, replace, workspaces, internal packages, vendoring, and a safe dependency update workflow.","md",null,{},{"icon":34},{"description":1261,"title":36},"Advanced Go modules guide covering semantic import versioning, minimum version selection, replace directives, go.work workspaces, internal packages, vendoring, and govulncheck.","Wyqi1N8bkdnWe3Bgs3GOoj--MacY49GnRL1_5_fhtr4",[1264,1266],{"title":31,"path":32,"stem":33,"description":1265,"icon":34,"children":-1},"Understand packages and modules, split code into your own packages, and add and remove third-party libraries.",{"title":45,"path":46,"stem":47,"description":1267,"icon":48,"children":-1},"Take a Go program apart to see how packages, imports, declarations, and the main entry point fit together.",1794118096474]