From 54b6edc4007c2c5abfcf38546cce591dbed87282 Mon Sep 17 00:00:00 2001 From: Andy Goldstein Date: Mon, 13 Mar 2017 12:30:56 -0400 Subject: [PATCH] go-to-protobuf: actually skip - packages If a package is prefixed with -, we are not supposed to be generating protobuf for it. Make that actually happen :-) --- cmd/libs/go2idl/go-to-protobuf/protobuf/cmd.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cmd/libs/go2idl/go-to-protobuf/protobuf/cmd.go b/cmd/libs/go2idl/go-to-protobuf/protobuf/cmd.go index b0ffbf4f91a..b86fee57994 100644 --- a/cmd/libs/go2idl/go-to-protobuf/protobuf/cmd.go +++ b/cmd/libs/go2idl/go-to-protobuf/protobuf/cmd.go @@ -137,6 +137,7 @@ func Run(g *Generator) { protobufNames := NewProtobufNamer() outputPackages := generator.Packages{} + nonOutputPackages := map[string]struct{}{} for _, d := range strings.Split(g.Packages, ",") { generateAllTypes, outputPackage := true, true switch { @@ -160,6 +161,8 @@ func Run(g *Generator) { protobufNames.Add(p) if outputPackage { outputPackages = append(outputPackages, p) + } else { + nonOutputPackages[name] = struct{}{} } } @@ -198,6 +201,10 @@ func Run(g *Generator) { var vendoredOutputPackages, localOutputPackages generator.Packages for _, p := range protobufNames.packages { + if _, ok := nonOutputPackages[p.Name()]; ok { + // if we're not outputting the package, don't include it in either package list + continue + } p.Vendored = strings.Contains(c.Universe[p.PackagePath].SourcePath, "/vendor/") if p.Vendored { vendoredOutputPackages = append(vendoredOutputPackages, p)