Skip to content

Commit

Permalink
Add optional feature in protobuf compiler
Browse files Browse the repository at this point in the history
Fixes error "is a proto3 file that contains optional fields, but code generator protoc-gen-go-ttrpc hasn't been updated to support optional fields in proto3. Please ask the owner of this code generator to support proto3 optional."

Signed-off-by: Derek McGowan <[email protected]>
  • Loading branch information
dmcgowan committed Feb 21, 2024
1 parent 90d421e commit 73b6a91
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions cmd/protoc-gen-go-ttrpc/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package main

import (
"google.golang.org/protobuf/compiler/protogen"
"google.golang.org/protobuf/types/pluginpb"
)

func main() {
Expand All @@ -30,6 +31,7 @@ func main() {
return nil
},
}.Run(func(gen *protogen.Plugin) error {
gen.SupportedFeatures = uint64(pluginpb.CodeGeneratorResponse_FEATURE_PROTO3_OPTIONAL)
for _, f := range gen.Files {
if !f.Generate {
continue
Expand Down

0 comments on commit 73b6a91

Please sign in to comment.