go mod tidy 优化go.mod文件

go help mod tidy
usage: go mod tidy [-v]

Tidy makes sure go.mod matches the source code in the module.
It adds any missing modules necessary to build the current module's
packages and dependencies, and it removes unused modules that
don't provide any relevant packages. It also adds any missing entries
to go.sum and removes any unnecessary ones.

The -v flag causes tidy to print information about removed modules
to standard error.

主要就两个功能:
1、添加需要用到但go.mod中查不到的模块,
2、删除未使用的模块

-v参数为打印信息。

你可能感兴趣的:(golang,golang)