2

the go mod tidy adds package dependencies to the go.mod file. How we can update them automatically without manually editing go.mod file, e.g. by removing some entries? For instance, if I use make I want to add a similar command that can update all dependencies of my package/repo and then compile the code with latest version of package dependencies.

Valentin
  • 1,492
  • 3
  • 18
  • 27

1 Answers1

5

In order to update all the dependencies you need to use:

go get -u

And then go mod tidy.

go get -u updates all packages and their dependencies, changing the go.mod.

ezeKG
  • 146
  • 1
  • 6