Merge pull request #112 from kzys/skip-empty-go-file
Only generate a Go file if the file has some services
This commit is contained in:
commit
944ef4a40d
@ -91,6 +91,11 @@ func newGenerator(out *protogen.GeneratedFile) *generator {
|
||||
}
|
||||
|
||||
func generate(plugin *protogen.Plugin, input *protogen.File) error {
|
||||
if len(input.Services) == 0 {
|
||||
// Only generate a Go file if the file has some services.
|
||||
return nil
|
||||
}
|
||||
|
||||
file := plugin.NewGeneratedFile(input.GeneratedFilenamePrefix+"_ttrpc.pb.go", input.GoImportPath)
|
||||
file.P("// Code generated by protoc-gen-go-ttrpc. DO NOT EDIT.")
|
||||
file.P("// source: ", input.Desc.Path())
|
||||
|
Loading…
Reference in New Issue
Block a user