Skip to content

Commit

Permalink
cmd/protoc-gen-go-grpc: reuse route_guide_grpc.pb.go as golden file (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
arvindbr8 committed Apr 16, 2024
1 parent 0c6d80c commit a2f8e61
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 633 deletions.
12 changes: 7 additions & 5 deletions cmd/protoc-gen-go-grpc/protoc-gen-go-grpc_test.sh
Expand Up @@ -31,14 +31,16 @@ popd
protoc \
--go-grpc_out="${TEMPDIR}" \
--go-grpc_opt=paths=source_relative \
"$WORKDIR/testdata/golden.proto"
"examples/route_guide/routeguide/route_guide.proto"

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

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

This file was deleted.

38 changes: 0 additions & 38 deletions cmd/protoc-gen-go-grpc/testdata/golden.proto

This file was deleted.

0 comments on commit a2f8e61

Please sign in to comment.