go Verified current stable Not installed? Programming

Go / List Module Dependencies And Updates

List Module Dependencies And Updates

Displays all module dependencies and their latest updates.

$
Terminal
go list -m -u all

When To Use

When preparing for a major release or assessment of vulnerabilities in current dependencies.

Pro Tip

Use ` -mod=readonly` to prevent module updates inadvertently breaking your build.

Anatomy of Output

Understanding the result

example.com/pkg v1.5.0 => v1.6.0 Dependency Version

Shows the current version and latest available version.

update available Update Status

Indicates that an update is available for this module.

Power User Variants

Optimized versions

go list -m -u example.com/pkg

Check updates for a specific module.

go list -m all -versions

Shows all available versions for each module.

Troubleshooting

Common pitfalls

go: invalid version: latest

Solution: Specify a valid version constraint. `go list -m -u example.com/pkg@v1.0.0`.

no module found

Solution: Ensure your project is a Go module and go.mod is present.

unrecognized import path

Solution: Check the import path for typos or capitalization issues.

Command Breakdown

What each part is doing

go
Base Command
The executable that performs this operation. Here it runs Go before the shell applies any redirect operators.
-m
Command Option
Tool-specific option used by this command invocation.
-u
Command Option
Tool-specific option used by this command invocation.

Alternative Approaches

Comparable commands in other tools

Alternative programming tools for the same job.