2018-03-26 10:52:36 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
set -eu -o pipefail
|
|
|
|
|
|
|
|
case ${1:-} in
|
|
|
|
'')
|
2018-04-03 12:43:53 +00:00
|
|
|
gogo_version=$(awk '$1 == "github.com/gogo/protobuf" { print $2 }' vendor.conf)
|
|
|
|
docker build --build-arg GOGO_VERSION=$gogo_version -f ./hack/dockerfiles/generated-files.Dockerfile --target validate --force-rm .
|
2018-03-26 10:52:36 +00:00
|
|
|
;;
|
|
|
|
check)
|
|
|
|
diffs="$(git status --porcelain -- **/*.pb.go 2>/dev/null)"
|
|
|
|
set +x
|
|
|
|
if [ "$diffs" ] ; then
|
|
|
|
{
|
|
|
|
echo 'The result of "go generate" differs'
|
|
|
|
echo
|
|
|
|
echo "$diffs"
|
|
|
|
echo
|
2018-04-03 12:44:47 +00:00
|
|
|
echo 'Please update with "make generated-files"'
|
2018-03-26 10:52:36 +00:00
|
|
|
echo
|
|
|
|
} >&2
|
|
|
|
false
|
|
|
|
fi
|
|
|
|
echo 'Congratulations! All auto generated files are correct.'
|
|
|
|
;;
|
|
|
|
esac
|