From 4993c2ec688a80e6f7934b2c9e0a545b99b99560 Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Wed, 13 Jan 2021 11:07:05 +0300 Subject: [PATCH] merge https://github.com/moul/protoc-gen-gotemplate/pull/101 Signed-off-by: Vasiliy Tolstov --- main.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/main.go b/main.go index 0c50cc0..d804f01 100644 --- a/main.go +++ b/main.go @@ -205,8 +205,17 @@ func main() { } } + filesToGenerate := map[string]struct{}{} + for _, file := range g.Request.FileToGenerate { + filesToGenerate[file] = struct{}{} + } + // Generate the encoders for _, file := range g.Request.GetProtoFile() { + // Ignore files not in g.Request.FileToGenerate. + if _, ok := filesToGenerate[*file.Name]; !ok { + continue + } if all { if singlePackageMode { if _, err = registry.LookupFile(file.GetName()); err != nil {