1
0
Fork 0
mirror of https://github.com/chrislusf/seaweedfs synced 2025-06-29 00:02:48 +02:00
seaweedfs/replace_imports.sh
2025-05-22 09:54:31 -07:00

32 lines
No EOL
824 B
Bash
Executable file

#!/bin/bash
# Find all Go files containing the old import path
files=$(grep -l "github.com/seaweedfs/seaweedfs/weed/glog" --include="*.go" -r .)
# Check if any files were found
if [ -z "$files" ]; then
echo "No files found containing the old import path"
exit 0
fi
# Print the files that will be modified
echo "The following files will be modified:"
echo "$files"
echo
# Ask for confirmation
read -p "Do you want to proceed with the replacement? (y/n) " -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
echo "Operation cancelled"
exit 1
fi
# Make the replacements
for file in $files; do
echo "Processing $file"
# Use sed to replace the import path
sed -i '' 's|github.com/seaweedfs/seaweedfs/weed/glog|github.com/seaweedfs/seaweedfs/weed/util/log|g' "$file"
done
echo "Replacement complete!"