mirror of
https://github.com/go-sylixos/elvish.git
synced 2024-11-27 15:01:22 +08:00
4a24084b38
Also configure the CI workflow to install stringer.
32 lines
922 B
Bash
Executable File
32 lines
922 B
Bash
Executable File
#!/bin/sh
|
|
# Check that generated Go source files are up to date.
|
|
|
|
git_unstaged() {
|
|
# The output of "git status -s" starts with two letters XY, where Y is the
|
|
# status in the working tree. Files that are staged in the index have Y
|
|
# being a space; exclude them.
|
|
git status -s | grep '^.[^ ]'
|
|
}
|
|
|
|
if ! which git >/dev/null; then
|
|
echo "$0 requires Git"
|
|
exit 1
|
|
fi
|
|
|
|
if test "$(git_unstaged)" != ""; then
|
|
echo "$0 must be run from a Git repo with no unstaged changes or untracked files"
|
|
exit 1
|
|
fi
|
|
|
|
go generate ./... || exit 1
|
|
x=$(git_unstaged)
|
|
|
|
if test "$x" != ""; then
|
|
echo "======================================================================"
|
|
echo "Generated Go code is out of date. See"
|
|
echo "https://github.com/elves/elvish/blob/master/CONTRIBUTING.md#generated-code"
|
|
echo "======================================================================"
|
|
echo "$x"
|
|
exit 1
|
|
fi
|