Go CLI Modules and Workspaces/Exclude bad version

Exclude a dependency version from selection.

Section: Dependency Updates

Exclude bad version

bash
bash
go mod edit -exclude example.com/lib@v1.2.4
Explanation

Exclude a dependency version from selection. 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 Dependency Updates
Verify module cache
Verify dependencies in module cache against go.sum.
OpenIn sheetbashsame section
Upgrade dependency
Update a dependency to the latest version.
OpenIn sheetbashsame section
Upgrade patch release
Update a dependency within its compatible patch/minor range.
OpenIn sheetbashsame section
List available updates
Show modules that have newer versions available.
OpenIn sheetbashsame section
Initialize module
Create a new go.mod for the current project.
OpenIn sheetbash2 tag match
Add replace directive
Point a module dependency to a local checkout.
OpenIn sheetbash2 tag match