Skip to content

Commit a2f8e61

Browse files
authored
cmd/protoc-gen-go-grpc: reuse route_guide_grpc.pb.go as golden file (#7134)
1 parent 0c6d80c commit a2f8e61

File tree

4 files changed

+7
-633
lines changed

4 files changed

+7
-633
lines changed

cmd/protoc-gen-go-grpc/protoc-gen-go-grpc_test.sh

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,16 @@ popd
3131
protoc \
3232
--go-grpc_out="${TEMPDIR}" \
3333
--go-grpc_opt=paths=source_relative \
34-
"$WORKDIR/testdata/golden.proto"
34+
"examples/route_guide/routeguide/route_guide.proto"
3535

36-
GOLDENFILE="${WORKDIR}/testdata/golden_grpc.pb.go"
37-
GENFILE="${TEMPDIR}/cmd/protoc-gen-go-grpc/testdata/golden_grpc.pb.go"
36+
GOLDENFILE="examples/route_guide/routeguide/route_guide_grpc.pb.go"
37+
GENFILE="${TEMPDIR}/examples/route_guide/routeguide/route_guide_grpc.pb.go"
3838

39-
DIFF=$(diff "${GOLDENFILE}" "${GENFILE}")
39+
# diff is piped to [[ $? == 1 ]] to avoid exiting on diff but exit on error
40+
# (like if the file was not found). See man diff for more info.
41+
DIFF=$(diff "${GOLDENFILE}" "${GENFILE}" || [[ $? == 1 ]])
4042
if [[ -n "${DIFF}" ]]; then
41-
echo -e "ERROR: Generated file golden_grpc.pb.go differs from golden file:\n${DIFF}"
43+
echo -e "ERROR: Generated file differs from golden file:\n${DIFF}"
4244
echo -e "If you have made recent changes to protoc-gen-go-grpc," \
4345
"please regenerate the golden files by running:" \
4446
"\n\t go generate google.golang.org/grpc/..." >&2

cmd/protoc-gen-go-grpc/testdata/golden.pb.go

Lines changed: 0 additions & 249 deletions
This file was deleted.

cmd/protoc-gen-go-grpc/testdata/golden.proto

Lines changed: 0 additions & 38 deletions
This file was deleted.

0 commit comments

Comments
 (0)