2020-05-08 20:39:36 +08:00
|
|
|
# go mod
|
|
|
|
|
2020-05-11 12:08:42 +08:00
|
|
|
> Module maintenance.
|
2025-06-28 15:06:36 -07:00
|
|
|
> More information: <https://pkg.go.dev/cmd/go#hdr-Module_maintenance>.
|
2020-05-11 12:08:42 +08:00
|
|
|
|
|
|
|
- Initialize new module in current directory:
|
|
|
|
|
|
|
|
`go mod init {{moduleName}}`
|
2020-05-08 20:39:36 +08:00
|
|
|
|
|
|
|
- Download modules to local cache:
|
|
|
|
|
|
|
|
`go mod download`
|
|
|
|
|
|
|
|
- Add missing and remove unused modules:
|
|
|
|
|
|
|
|
`go mod tidy`
|
|
|
|
|
2020-05-11 12:08:42 +08:00
|
|
|
- Verify dependencies have expected content:
|
|
|
|
|
|
|
|
`go mod verify`
|
|
|
|
|
2020-05-15 00:01:50 +08:00
|
|
|
- Copy sources of all dependencies into the vendor directory:
|
2020-05-08 20:39:36 +08:00
|
|
|
|
|
|
|
`go mod vendor`
|