[VOL-1460]
Build Go stubs using the Makefile, instead of in a separate script.
New method is independent of GOPATH (which makes testing easier), and is
'go_package' aware, so any new .proto files will have directories
created and regenerated under go/
Cleaned up README.md and Makefile
Lexically sort input to protoc as --descriptor_set_out differs depending
on the order of file arguments passed to it.
Released v0.1.2
Change-Id: If9d5aabc89b4d73f3e069b01b38bd0bf8d1b3c43
diff --git a/test/test-go-proto-consistency.sh b/test/test-go-proto-consistency.sh
index 64719cb..76ac7b1 100755
--- a/test/test-go-proto-consistency.sh
+++ b/test/test-go-proto-consistency.sh
@@ -1,8 +1,4 @@
-set -e
-
-#This test validates that go proto outputs are committed to git.
-#It does this by generating them and validating whether go thinks they are the same.
-#If they become out of sync, there can be problems for consumers of the protos.
+#!/usr/bin/env bash
# Copyright 2018 the original author or authors.
#
@@ -17,6 +13,15 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
+
+# test-go-proto-consistency.sh
+#
+# This test validates that go proto outputs are committed to git. It does this
+# by regenerating them and validating whether git thinks they are the same. If
+# they become out of sync, there can be problems for consumers of the protos.
+
+set -eu -o pipefail
+
git status > /dev/null
STAGED="$(git diff-index --quiet HEAD -- || echo 'staged')"
UNTRACKED="$(git ls-files --exclude-standard --others)"
@@ -26,11 +31,12 @@
exit 1
fi
+# delete and regenerate go protos
+rm -rf go/voltha.pb go/*/*.pb.go go_temp
make go-protos
# Running git status ensures correct git diff-index picks up changes
git status > /dev/null
-
STAGED_POST="$(git diff-index --quiet HEAD -- || echo "staged")"
UNTRACKED_POST="$(git ls-files --exclude-standard --others)"