Update All Go Packages in Your Project

If you want to update all dependencies and packages within your project then the simplest way is to use the go get command which handles it all for us. Go modules (go mod) will handle most of the versioning of these packages, so deploying and sharing the project will keep the same package versions.

We’ve added the command and explanation below.

1
go get -u ./...

go get

This is the base command to get packages in Go.

-u

This flag says packages should update. We’ve added the official explination below.

The -u flag instructs get to update modules providing dependencies of packages named on the command line to use newer minor or patch releases when available.

./…

All packages and dependencies within the project.