Show the module dependency graph.

Section: Modules Basics

Print module graph

bash
bash
go mod graph
Explanation

Show the module dependency graph. 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
Download dependencies
Pre-fetch required modules into the module cache.
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