mirror of
https://gitee.com/johng/gf
synced 2026-07-06 21:45:34 +08:00
fixed #4479 修复gf gen dao执行严重变慢的问题 主要调整,降级两个依赖库 `go get golang.org/x/tools@v0.26.0` // 直接依赖 `go get golang.org/x/text@v0.25.0` // 间接依赖 至于为什么这两个库会导致慢,还需要深入排查
36 lines
846 B
Bash
Executable File
36 lines
846 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
workdir=.
|
|
echo "Prepare to tidy all go.mod files in the ${workdir} directory"
|
|
|
|
# check find command support or not
|
|
output=$(find "${workdir}" -name go.mod 2>&1)
|
|
if [[ $? -ne 0 ]]; then
|
|
echo "Error: please use bash or zsh to run!"
|
|
exit 1
|
|
fi
|
|
|
|
for file in `find ${workdir} -name go.mod`; do
|
|
goModPath=$(dirname $file)
|
|
echo ""
|
|
echo "processing dir: $goModPath"
|
|
|
|
if [[ $goModPath =~ "/testdata/" ]]; then
|
|
echo "ignore testdata path $goModPath"
|
|
continue 1
|
|
fi
|
|
|
|
if [[ $goModPath =~ "/examples/" ]]; then
|
|
echo "ignore examples path $goModPath"
|
|
continue 1
|
|
fi
|
|
|
|
cd $goModPath
|
|
# Remove indirect dependencies
|
|
sed -i '/\/\/ indirect/d' go.mod
|
|
go mod tidy
|
|
# Remove toolchain line if exists
|
|
sed -i '' '/^toolchain/d' go.mod
|
|
cd - > /dev/null
|
|
done
|