Created
February 17, 2024 15:10
-
-
Save dxdns/bdd71be691aff1a59cc95fac2cd13f39 to your computer and use it in GitHub Desktop.
go-module-rename
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
OLD_MODULE_NAME="old-module-name" | |
read -p "Enter OLD_MODULE_NAME: " OLD_MODULE_NAME | |
NEW_MODULE_NAME="hello-host" | |
read -p "Enter NEW_MODULE_NAME: " NEW_MODULE_NAME | |
go mod edit -module $NEW_MODULE_NAME | |
find . -name '*.go' -print0 \ | |
| xargs -0 sed -i -e "s|${OLD_MODULE_NAME}|${NEW_MODULE_NAME}|" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment