Skip to content

Instantly share code, notes, and snippets.

@opchaves
Last active December 11, 2022 13:44
Show Gist options
  • Save opchaves/94a299c61d76a84fceb9063697d6d5bc to your computer and use it in GitHub Desktop.
Save opchaves/94a299c61d76a84fceb9063697d6d5bc to your computer and use it in GitHub Desktop.
Renaming go mod and imports across the project
#!/bin/bash
for file in ./<some-regex-to-find-files>/**/*.go
do
if [ -w "$file" ]
then
echo $file
sed -i '' 's/<old_user>\/<old_project>/<new_user>\/<new_project>/g' $file
else
echo "Cannot write on $file"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment