Added support for proto3 field presence (#3752)

This commit is contained in:
Garrett Gutierrez 2020-07-23 09:01:20 -07:00 committed by GitHub
parent a1ace9105a
commit cee815dbe3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -34,6 +34,7 @@ import (
"flag"
"google.golang.org/protobuf/compiler/protogen"
"google.golang.org/protobuf/types/pluginpb"
)
var requireUnimplemented *bool
@ -45,6 +46,7 @@ func main() {
protogen.Options{
ParamFunc: flags.Set,
}.Run(func(gen *protogen.Plugin) error {
gen.SupportedFeatures = uint64(pluginpb.CodeGeneratorResponse_FEATURE_PROTO3_OPTIONAL)
for _, f := range gen.Files {
if !f.Generate {
continue