Skip to content

Commit

Permalink
refactor(gRPC): update go proto file
Browse files Browse the repository at this point in the history
  • Loading branch information
appleboy committed Nov 9, 2022
1 parent e13a05b commit 8b4424c
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 25 deletions.
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ GOFILES := $(shell find . -name "*.go" -type f)
TAGS ?= sqlite
LDFLAGS ?= -X 'main.Version=$(VERSION)'

PROTOC_GEN_GO=v1.28
PROTOC_GEN_GO_GRPC=v1.2

ifneq ($(shell uname), Darwin)
EXTLDFLAGS = -extldflags "-static" $(null)
else
Expand Down Expand Up @@ -163,6 +166,11 @@ clean:
find . -name *.db -delete
-rm -rf release dist .cover

.PHONY: proto_install
proto_install:
$(GO) install google.golang.org/protobuf/cmd/protoc-gen-go@$(PROTOC_GEN_GO)
$(GO) install google.golang.org/grpc/cmd/protoc-gen-go-grpc@$(PROTOC_GEN_GO_GRPC)

generate_proto_js:
npm install grpc-tools
protoc -I rpc/proto rpc/proto/gorush.proto --js_out=import_style=commonjs,binary:rpc/example/node/ --grpc_out=rpc/example/node/ --plugin=protoc-gen-grpc="node_modules/.bin/grpc_tools_node_protoc_plugin"
Expand Down
36 changes: 16 additions & 20 deletions rpc/proto/gorush.pb.go

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

3 changes: 1 addition & 2 deletions rpc/proto/gorush.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ syntax = "proto3";
import "google/protobuf/struct.proto";

package proto;

// option go_package = "./;proto";
option go_package = "./;proto";

message Alert {
string title = 1;
Expand Down
11 changes: 8 additions & 3 deletions rpc/proto/gorush_grpc.pb.go

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

0 comments on commit 8b4424c

Please sign in to comment.