From adbc182eeedde3ea48a764543df4742e7c658078 Mon Sep 17 00:00:00 2001 From: k1LoW Date: Wed, 22 Mar 2023 14:50:29 +0900 Subject: [PATCH] Support `optional` label of proto3 The following error occurs when using the `optional` label for proto3. ``` Warning: plugin "go-grpc-mock" does not support required features. Feature "proto3 optional" is required by ** file(s): ``` Add setting to accept `optional` label. --- main.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/main.go b/main.go index 9c51306..3ee9b0b 100644 --- a/main.go +++ b/main.go @@ -6,6 +6,7 @@ import ( "github.com/golang/mock/mockgen/model" "google.golang.org/protobuf/compiler/protogen" + "google.golang.org/protobuf/types/pluginpb" ) type methodType int @@ -385,6 +386,7 @@ func baseServerStreamMethods() []*model.Method { func main() { protogen.Options{}.Run(func(plugin *protogen.Plugin) error { + plugin.SupportedFeatures = uint64(pluginpb.CodeGeneratorResponse_FEATURE_PROTO3_OPTIONAL) for path, file := range plugin.FilesByPath { if !file.Generate { continue