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 9ce5bb7
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 @@ -39,6 +39,7 @@ log_callout -e "\\nRunning gofast (gogo) proto generation..."
for dir in ${DIRS}; do
run pushd "${dir}"
run protoc --gofast_out=plugins=grpc:. -I=".:${GOGOPROTO_PATH}:${ETCD_ROOT_DIR}/..:${ETCD_ROOT_DIR}:${ETCD_ROOT_DIR}/third_party/googleapis" \
--go_opt=Mgoogle/protobuf/descriptor.proto=github.com/gogo/protobuf/protoc-gen-gogo/descriptor \
--plugin="${GOFAST_BIN}" ./**/*.proto

run sed -i.bak -E 's|"etcd/api/|"go.etcd.io/etcd/api/v3/|g' ./**/*.pb.go
Expand Down

0 comments on commit 9ce5bb7

Please sign in to comment.