Files
gf/.make_tidy.sh
John Guo 98fd2a1973 chore: cleanup makefile, remove unnecessary scripts (#4684)
This pull request primarily removes submodule management targets from
the `Makefile` and makes minor updates to the project documentation in
both English and Chinese. The most important changes are grouped below.

Makefile cleanup:

* Removed the `subup` and `subsync` targets from the `Makefile`,
eliminating commands related to updating and committing submodules.

Documentation updates:

* Updated the logo alt text in both `README.MD` and `README.zh_CN.MD`
from "goframe gf logo" to "goframe logo" for clarity.
[[1]](diffhunk://#diff-01e6d9ffed056a02cae8d8a0ec5d476a64d017bf85c0d5a94bb23ca21f33f5aaL4-R4)
[[2]](diffhunk://#diff-c93759cb9a9500f20e551c741eb167fc72825fd638d36121357feb8253ce6ac1L4-R4)
* Revised a description in `README.zh_CN.MD` to clarify the framework's
purpose, changing “一个强大的框架” to “一款强大的框架”.
* Simplified the license description in `README.zh_CN.MD` to state
"100%开源和免费".
2026-02-11 14:37:49 +08:00

47 lines
1.1 KiB
Bash
Executable File

#!/usr/bin/env bash
# Function to run sed in-place with OS-specific options
sed_replace() {
if [[ "$OSTYPE" == "darwin"* ]]; then
# macOS - requires empty string after -i
sed -i '' "$@"
else
# Linux/Windows Git Bash
sed -i "$@"
fi
}
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_replace '/\/\/ indirect/d' go.mod
go mod tidy
# Remove toolchain line if exists
sed_replace '/^toolchain/d' go.mod
cd - > /dev/null
done