error generate in standalone mode
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
11
util.go
11
util.go
@@ -968,8 +968,10 @@ func (g *Generator) writeErrors(plugin *protogen.Plugin) error {
|
||||
}
|
||||
|
||||
var gfile *protogen.GeneratedFile
|
||||
var importPath protogen.GoImportPath
|
||||
|
||||
if len(errorsMap) > 0 {
|
||||
gfile = plugin.NewGeneratedFile("micro_errors.pb.go", ".")
|
||||
|
||||
var packageName string
|
||||
|
||||
for _, file := range plugin.Files {
|
||||
@@ -980,9 +982,16 @@ func (g *Generator) writeErrors(plugin *protogen.Plugin) error {
|
||||
continue
|
||||
}
|
||||
packageName = string(file.GoPackageName)
|
||||
importPath = file.GoImportPath
|
||||
break
|
||||
}
|
||||
|
||||
if g.standalone {
|
||||
importPath = "."
|
||||
}
|
||||
|
||||
gfile = plugin.NewGeneratedFile("micro_errors.pb.go", importPath)
|
||||
|
||||
gfile.P("// Code generated by protoc-gen-go-micro. DO NOT EDIT.")
|
||||
gfile.P("// protoc-gen-go-micro version: " + versionComment)
|
||||
gfile.P()
|
||||
|
Reference in New Issue
Block a user