1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
#!/bin/sh
set -e
CDPATH="" cd -- "$(dirname -- "$0")/.."
if [ "$1" = "--check" ]; then
[ -z "$(git status --porcelain)" ] || {
git status
echo 1>&2 "Running 'script/generate --check' requires a clean git working tree. Please commit or stash changes and try again."
exit 1
}
script/generate
[ -z "$(git status --porcelain)" ] || {
git status
echo 1>&2 "script/generate resulted in changes. Please commit changes (or 'git reset --hard HEAD' if you aren't ready to commit changes)."
git diff
exit 1
}
exit 0
fi
go generate ./...
|