Skip to content

Instantly share code, notes, and snippets.

@snarlysodboxer
Created June 4, 2020 16:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save snarlysodboxer/b145716f0c85c34787037b328a11a5f1 to your computer and use it in GitHub Desktop.
Save snarlysodboxer/b145716f0c85c34787037b328a11a5f1 to your computer and use it in GitHub Desktop.
Swap Go Imports, for working with forked repos
#!/bin/bash
if [ "$1" != "snarly" ] && [ "$1" != "fr" ]; then
echo "specify snarly or fr"
exit 1
fi
if [ "$1" == "snarly" ]; then
find . -name '*.go' | xargs sed -i.bak 's/ForgeRock\/secret-agent/snarlysodboxer\/secret-agent/'
sed -i.bak 's/ForgeRock\/secret-agent/snarlysodboxer\/secret-agent/' go.mod
else
find . -name '*.go' | xargs sed -i.bak 's/snarlysodboxer\/secret-agent/ForgeRock\/secret-agent/'
sed -i.bak 's/snarlysodboxer\/secret-agent/ForgeRock\/secret-agent/' go.mod
fi
find . -name '*.go.bak' -delete
rm -rf go.mod.bak
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment