Skip to content

Commit

Permalink
apply protoc build options and refine the genproto.sh
Browse files Browse the repository at this point in the history
Signed-off-by: Wei Fu <[email protected]>
  • Loading branch information
ahrtr committed Aug 22, 2023
1 parent 80b7034 commit fce9de7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
10 changes: 5 additions & 5 deletions api/versionpb/version.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 1 addition & 5 deletions scripts/genproto.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,11 @@ 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}/..:${RAFT_ROOT}:${ETCD_ROOT_DIR}:${GOOGLEAPI_ROOT}" \
--gofast_opt=paths=source_relative \
--gofast_opt=paths=source_relative,Mraftpb/raft.proto=go.etcd.io/raft/v3/raftpb,Mgoogle/protobuf/descriptor.proto=github.com/gogo/protobuf/protoc-gen-gogo/descriptor \
-I"${GRPC_GATEWAY_ROOT}" \
--plugin="${GOFAST_BIN}" ./**/*.proto

run sed -i.bak -E 's|"etcd/api/|"go.etcd.io/etcd/api/v3/|g' ./**/*.pb.go
run sed -i.bak -E 's|"raftpb"|"go.etcd.io/raft/v3/raftpb"|g' ./**/*.pb.go
run sed -i.bak -E 's|"google/protobuf"|"github.com/gogo/protobuf/protoc-gen-gogo/descriptor"|g' ./**/*.pb.go

rm -f ./**/*.bak
run gofmt -s -w ./**/*.pb.go
run_go_tool "golang.org/x/tools/cmd/goimports" -w ./**/*.pb.go
run popd
Expand Down

0 comments on commit fce9de7

Please sign in to comment.