golang go-zero微服务开发,分的rpc项目太多了,变更了公共包,需要手动去拉取,直接一键拉取就好了,创建一个windwos脚本文件
文件名 tidy_all_go_mod.ps1
代码
# 辅助工具拉取go mod tidy
# 根目录v99main执行 ./tidy_all_go_mod.ps1
# 定义项目的根目录
$RootDir = Get-Location
# 定义所有微服务目录
$Services = @(
"admin-core"
"agentrpc"
"cmsrpc"
"payrpc"
"userrpc"
"apiend"
"gmerpc"
"plat/rpc"
"plat/api"
)
# 遍历服务目录并执行 go mod tidy
foreach ($Service in $Services) {
Write-Host "Processing: $Service"
Set-Location -Path "$RootDir\$Service"
go mod tidy
Write-Host "$Service done go mod tidy"
}
# 退回主目录
Set-Location -Path "$RootDir"
Write-Host "success go mod tidy"
执行
./tidy_all_go_mod.ps1