Go CLI Modules and Workspaces/Download dependencies

Pre-fetch required modules into the module cache.

Section: Modules Basics

Download dependencies

bash
bash
go mod download
Explanation

Pre-fetch required modules into the module cache. Useful in Go CLI workflows.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Modules Basics
Initialize module
Create a new go.mod for the current project.
OpenIn sheetbashsame section
Tidy dependencies
Add missing and remove unused module requirements.
OpenIn sheetbashsame section
Print module graph
Show the module dependency graph.
OpenIn sheetbashsame section
Explain dependency
Show why a package or module is needed.
OpenIn sheetbashsame section
Add replace directive
Point a module dependency to a local checkout.
OpenIn sheetbash2 tag match
Add require directive
Add an explicit module requirement.
OpenIn sheetbash2 tag match