Created
March 13, 2024 22:00
-
-
Save bldrdash/958b856549d0af45dffcb50f692b9c1d to your computer and use it in GitHub Desktop.
Rename golang module
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ -z "$1" -o -z "$2" ]; then | |
echo $0 oldmod newmod | |
exit 1 | |
fi | |
OLD_MODULE="$1" | |
NEW_MODULE="$2" | |
if [ ! -f go.mod ]; then | |
echo "Could not find go.mod" | |
exit 1 | |
fi | |
sed -i -e "s,${OLD_MODULE},${NEW_MODULE},g" go.mod | |
find . -type f -name '*.go' -exec sed -i -e "s,${OLD_MODULE},${NEW_MODULE},g" {} \; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment