Last active
March 7, 2019 21:11
-
-
Save Kubuxu/3fc5639db27f4b072b33a84b51048ff8 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/usr/bin/env bash | |
BADGOMODREGEX='\+replace.*=>\s+[/.]' | |
exec < /dev/tty | |
if git ls-files go.mod >/dev/null && [[ $(git diff --cached go.mod | grep -E -c "$BADGOMODREGEX") -ne 0 ]]; then | |
git diff --cached go.mod | grep -E "$BADGOMODREGEX" | |
read -p "There are local replace directives in go.mod. Are you sure you want to continue (y/n): " yn | |
if echo "$yn" | grep "^[Yy]$" > /dev/null; then | |
exit 0; #THE USER WANTS TO CONTINUE | |
else | |
exit 1; # THE USER DONT WANT TO CONTINUE SO ROLLBACK | |
fi | |
fi | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment