allow to generate standalone code

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
2021-02-25 14:19:09 +03:00
parent 8e89b899d8
commit 9f2dd3ed35
7 changed files with 76 additions and 148 deletions

6
rpc.go
View File

@@ -14,7 +14,11 @@ func (g *Generator) rpcGenerate(component string, plugin *protogen.Plugin) error
}
gname := file.GeneratedFilenamePrefix + "_micro_" + component + ".pb.go"
gfile := plugin.NewGeneratedFile(gname, file.GoImportPath)
path := file.GoImportPath
if g.standalone {
path = "."
}
gfile := plugin.NewGeneratedFile(gname, path)
gfile.P("// Code generated by protoc-gen-micro")
gfile.P("// source: ", *file.Proto.Name)