Upgrading Go Module Dependencies
To maintain the currency of your Go module dependencies, there are several approaches to consider.
Listing Dependencies with Updates
To view available minor and patch upgrades for all dependencies, including direct and indirect ones, execute the following command:
go list -u -m all
Listing Only Direct Dependencies with Updates
If you only want to view updates for direct dependencies, add a custom template format to your go list command:
go list -u -m -f '{{if not .Indirect}}{{.}}{{end}}' all
Using a Third-Party Tool
The go-mod-outdated tool provides an easy way to identify outdated dependencies. It offers a table view with available updates for both direct and indirect dependencies.
Additional Notes
Related Resources
The above is the detailed content of How Can I Upgrade My Go Module Dependencies?. For more information, please follow other related articles on the PHP Chinese website!