Fix protobuf generation

This commit is contained in:
Jordan Liggitt 2022-02-26 12:54:36 -05:00
parent 343125cc6c
commit f68adbcd59
2 changed files with 17 additions and 1 deletions

View File

@ -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)

View File

@ -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 = &param
break
}
}
// generate
command.Write(command.Generate(request))
}