Skip to content

Commit

Permalink
protoc plugin supports proto3 optional (#63)
Browse files Browse the repository at this point in the history
  • Loading branch information
jhump authored Feb 15, 2022
1 parent e84b4a5 commit d9a9578
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 384 deletions.
11 changes: 6 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ checkgofmt:

.PHONY: generate
generate:
@GO111MODULE=on go install ./cmd/protoc-gen-grpchan
@GO111MODULE=on go install github.com/golang/protobuf/protoc-gen-go
@go install ./cmd/protoc-gen-grpchan
@go install google.golang.org/protobuf/cmd/protoc-gen-go@a709e31e5d12
@go install google.golang.org/grpc/cmd/[email protected]
go generate ./...

.PHONY: vet
Expand All @@ -37,17 +38,17 @@ vet:

.PHONY: staticcheck
staticcheck:
@GO111MODULE=on go install honnef.co/go/tools/cmd/staticcheck
@GO111MODULE=on go install honnef.co/go/tools/cmd/staticcheck@v0.0.1-2020.1.4
staticcheck ./...

.PHONY: ineffassign
ineffassign:
@GO111MODULE=on go install github.com/gordonklaus/ineffassign
@GO111MODULE=on go install github.com/gordonklaus/ineffassign@v0.0.0-20200309095847-7953dde2c7bf
ineffassign .

.PHONY: predeclared
predeclared:
@GO111MODULE=on go install github.com/nishanths/predeclared
@GO111MODULE=on go install github.com/nishanths/predeclared@v0.0.0-20200524104333-86fad755b4d3
predeclared .

# Intentionally omitted from CI, but target here for ad-hoc reports.
Expand Down
2 changes: 1 addition & 1 deletion cmd/protoc-gen-grpchan/gen_test_pb_test.go

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

2 changes: 2 additions & 0 deletions cmd/protoc-gen-grpchan/protoc-gen-grpchan.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@ import (
"github.com/jhump/gopoet"
"github.com/jhump/goprotoc/plugins"
"github.com/jhump/protoreflect/desc"
"google.golang.org/protobuf/types/pluginpb"
)

func main() {
plugins.PluginMain(doCodeGen)
}

func doCodeGen(req *plugins.CodeGenRequest, resp *plugins.CodeGenResponse) error {
resp.SupportsFeatures(pluginpb.CodeGeneratorResponse_FEATURE_PROTO3_OPTIONAL)
args, err := parseArgs(req.Args)
if err != nil {
return err
Expand Down
15 changes: 5 additions & 10 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,11 @@ module github.com/fullstorydev/grpchan
go 1.13

require (
github.com/golang/protobuf v1.4.2
github.com/gordonklaus/ineffassign v0.0.0-20200309095847-7953dde2c7bf // indirect
github.com/golang/protobuf v1.5.0
github.com/jhump/gopoet v0.1.0
github.com/jhump/goprotoc v0.4.0
github.com/jhump/protoreflect v1.5.0
github.com/nishanths/predeclared v0.0.0-20200524104333-86fad755b4d3 // indirect
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b
github.com/jhump/goprotoc v0.5.0
github.com/jhump/protoreflect v1.11.0
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013
google.golang.org/grpc v1.36.0
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0 // indirect
google.golang.org/protobuf v1.25.0
honnef.co/go/tools v0.0.1-2020.1.4 // indirect
google.golang.org/grpc v1.38.0
google.golang.org/protobuf v1.26.0
)
385 changes: 19 additions & 366 deletions go.sum

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion grpchantesting/test.pb.go

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

2 changes: 1 addition & 1 deletion httpgrpc/httpgrpc.pb.go

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

0 comments on commit d9a9578

Please sign in to comment.