From eafc143398baa032f3815ddcfdcf587ffbc982c8 Mon Sep 17 00:00:00 2001 From: Joshua Humphries Date: Fri, 19 Jul 2019 08:19:01 -0400 Subject: [PATCH] imports still included in descriptor even when --include_imports not set (#23) --- app/goprotoc/goprotoc.go | 2 +- plugins/exec.go | 2 +- plugins/plugin.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/goprotoc/goprotoc.go b/app/goprotoc/goprotoc.go index f8d9bdd..28d5cd0 100644 --- a/app/goprotoc/goprotoc.go +++ b/app/goprotoc/goprotoc.go @@ -318,7 +318,7 @@ func toFileDescriptorSet(alreadySeen, fileNames map[string]struct{}, fdSet *desc for _, dep := range fd.GetDependencies() { if !includeImports { // we only include deps that were explicitly in the set of file names given - if _, ok := fileNames[fd.GetName()]; !ok { + if _, ok := fileNames[dep.GetName()]; !ok { continue } } diff --git a/plugins/exec.go b/plugins/exec.go index 4520a37..9a187f4 100644 --- a/plugins/exec.go +++ b/plugins/exec.go @@ -112,7 +112,7 @@ func PluginMain(plugin Plugin) { os.Stdout = os.Stderr if err := RunPlugin(os.Args[0], plugin, os.Stdin, output); err != nil { - fmt.Fprintf(os.Stderr, "%v\n", err) + _, _ = fmt.Fprintf(os.Stderr, "%v\n", err) os.Exit(1) } // Success! diff --git a/plugins/plugin.go b/plugins/plugin.go index 3d79f47..0b860f7 100644 --- a/plugins/plugin.go +++ b/plugins/plugin.go @@ -103,7 +103,7 @@ type ProtocVersion struct { func (v ProtocVersion) String() string { var buf bytes.Buffer - fmt.Fprintf(&buf, "%d.%d.%d", v.Major, v.Minor, v.Patch) + _, _ = fmt.Fprintf(&buf, "%d.%d.%d", v.Major, v.Minor, v.Patch) if v.Suffix != "" { if v.Suffix[0] != '-' { buf.WriteRune('-')