go mod command
作者:互联网
go mod init [module path]
This command creates a new go.mod file in the current directory. It means a new module is rooted at the current directory.
go mod tidy [...]
This command adds any missing module requirements which are necessary and remove unused ones.
go get [module path]
The module we get from go get command is in the module cache.
workspace and multiple modules management
A workspace is a collection of modules.
go work init [directory of a module]
This command creates a go.work file in the workspace directory. The workspace contains the modules in the [directory of a module]. Then we can use go run command to run a module in the workspace.
go work use [directory]
This command adds a new module into the go.work file.
标签:module,directory,command,workspace,go,mod 来源: https://www.cnblogs.com/hicuppers-/p/16289556.html