Skip to content

Commit

Permalink
proto: specify the go import path for google/protobuf/descriptor.prot…
Browse files Browse the repository at this point in the history
…o on command line

The value of `go_package` in google/protobuf/descriptor.proto is "descriptor",
which isn't supported by protoc-gen-grpc-gateway v2. The error message is:
```
stderr: protoc-gen-grpc-gateway: invalid Go import path "descriptor" for "google/protobuf/descriptor.proto"
stderr:
stderr: The import path must contain at least one period ('.') or forward slash ('/') character.
```

The solution is to specify the go import path on command line in format: M${PROTO_FILE}=${GO_IMPORT_PATH}.

Signed-off-by: Benjamin Wang <[email protected]>
  • Loading branch information
ahrtr committed Sep 27, 2022
1 parent 0f081c7 commit 9a1c1ba
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions scripts/genproto.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ for pb in api/etcdserverpb/rpc server/etcdserver/api/v3lock/v3lockpb/v3lock serv
--grpc-gateway_out=logtostderr=true,paths=source_relative:. \
--swagger_out=logtostderr=true:./Documentation/dev-guide/apispec/swagger/. \
--plugin="${SWAGGER_BIN}" --plugin="${GRPC_GATEWAY_BIN}" \
--go_opt=Mgoogle/protobuf/descriptor.proto=github.com/gogo/protobuf/protoc-gen-gogo/descriptor \
${pb}.proto
# hack to move gw files around so client won't include them
pkgpath=$(dirname "${pb}")
Expand Down

0 comments on commit 9a1c1ba

Please sign in to comment.