Skip to content

Instantly share code, notes, and snippets.

@jarrpa
Created April 21, 2022 16:10
Show Gist options
  • Save jarrpa/c4c2a5a2e7d8ed3a1c997863d262df1b to your computer and use it in GitHub Desktop.
Save jarrpa/c4c2a5a2e7d8ed3a1c997863d262df1b to your computer and use it in GitHub Desktop.
go-module-rename.sh
#!/bin/bash
set -e
OLD_NAME="${1}"
NEW_NAME="${2}"
go mod edit -module ${NEW_NAME}
find . -type f -name '*.go' \
-exec sed -i -e "'s,${OLD_NAME},${NEW_NAME},g'" {} \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment