diff --git a/staging/src/k8s.io/code-generator/cmd/go-to-protobuf/protobuf/cmd.go b/staging/src/k8s.io/code-generator/cmd/go-to-protobuf/protobuf/cmd.go index 47e400f930a..8a92082bef1 100644 --- a/staging/src/k8s.io/code-generator/cmd/go-to-protobuf/protobuf/cmd.go +++ b/staging/src/k8s.io/code-generator/cmd/go-to-protobuf/protobuf/cmd.go @@ -260,6 +260,7 @@ func Run(g *Generator) { if len(g.Conditional) > 0 { fmt.Fprintf(buf, "// +build %s\n\n", g.Conditional) } + buf.Write(boilerplate) for _, outputPackage := range outputPackages { p := outputPackage.(*protobufPackage) diff --git a/staging/src/k8s.io/code-generator/cmd/go-to-protobuf/protoc-gen-gogo/main.go b/staging/src/k8s.io/code-generator/cmd/go-to-protobuf/protoc-gen-gogo/main.go index 6e5051dce19..3e188dca578 100644 --- a/staging/src/k8s.io/code-generator/cmd/go-to-protobuf/protoc-gen-gogo/main.go +++ b/staging/src/k8s.io/code-generator/cmd/go-to-protobuf/protoc-gen-gogo/main.go @@ -19,6 +19,8 @@ limitations under the License. package main import ( + "strings" + "github.com/gogo/protobuf/vanity/command" // dependencies that are required for our packages @@ -28,5 +30,18 @@ import ( ) func main() { - command.Write(command.Generate(command.Read())) + // read input + request := command.Read() + + // if we're given paths as inputs, generate .pb.go files based on those paths + for _, file := range request.FileToGenerate { + if strings.Contains(file, "/") { + param := "paths=source_relative" + request.Parameter = ¶m + break + } + } + + // generate + command.Write(command.Generate(request)) }