Created
May 29, 2024 01:39
-
-
Save stevegt/74e62b4bc64104dca8966e295ceb7b2a to your computer and use it in GitHub Desktop.
a script I use to automate the go test/git commit cycle when doing rapid development and refactoring
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
#!/bin/bash | |
if [ -z "$1" ] | |
then | |
echo "Usage: $0 <paths-to-watch>" | |
exit 1 | |
fi | |
# get current window id | |
window_id=$(xdotool getactivewindow) | |
set -x | |
while true | |
do inotifywait -r -e modify "$@" | |
padsp signalgen -t 100m sin 444 | |
sleep 1 | |
if ! go vet ./... | |
then | |
padsp signalgen -t 100m sin 300 | |
banner vet | |
continue | |
fi | |
if time go test -v -race -failfast -timeout 120s ./... | |
then | |
padsp signalgen -t 100m sin 555 | |
git add -A; grok commit | git commit -F- | |
padsp signalgen -t 100m sin 666 | |
banner ok | |
else | |
padsp signalgen -t 100m sin 300 | |
banner fail | |
fi | |
echo ------------------------------------------------------------- | |
# xdotool windowactivate $window_id | |
done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment