aboutsummaryrefslogtreecommitdiff
path: root/replace_imports.sh
diff options
context:
space:
mode:
authorchrislu <chris.lu@gmail.com>2025-05-22 09:54:31 -0700
committerchrislu <chris.lu@gmail.com>2025-05-22 09:54:31 -0700
commit0d62be44846354c3c37b857028297edd4b8df17b (patch)
treec89320a7d58351030f1b740c7267f56bf0206429 /replace_imports.sh
parentd8c574a5ef1a811f9a0d447097d9edfcc0c1d84c (diff)
downloadseaweedfs-origin/changing-to-zap.tar.xz
seaweedfs-origin/changing-to-zap.zip
Diffstat (limited to 'replace_imports.sh')
-rwxr-xr-xreplace_imports.sh32
1 files changed, 32 insertions, 0 deletions
diff --git a/replace_imports.sh b/replace_imports.sh
new file mode 100755
index 000000000..50670775d
--- /dev/null
+++ b/replace_imports.sh
@@ -0,0 +1,32 @@
+#!/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!" \ No newline at end of file