Skip to content

Instantly share code, notes, and snippets.

@CypherpunkSamurai
Forked from iamucil/go mod rename module.sh
Last active August 13, 2022 03:34
Show Gist options
  • Select an option

  • Save CypherpunkSamurai/883e0d1bc7ce96c8daab40ee6b7a6da4 to your computer and use it in GitHub Desktop.

Select an option

Save CypherpunkSamurai/883e0d1bc7ce96c8daab40ee6b7a6da4 to your computer and use it in GitHub Desktop.
go rename modules
OLD_MODULE_NAME="$0"
NEW_MODULE_NAME="$1"
go mod edit -module ${NEW_MODULE_NAME}
-- rename all imported module
find . -type f -name '*.go' \
-exec sed -i -e 's,{OLD_MODULE_NAME},{NEW_MODULE_NAME},g' {} \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment