allow to catch response headers
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
20
micro.go
20
micro.go
@@ -1,6 +1,8 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"google.golang.org/protobuf/compiler/protogen"
|
||||
)
|
||||
|
||||
@@ -22,8 +24,10 @@ func (g *Generator) microGenerate(component string, plugin *protogen.Plugin, gen
|
||||
gfile := plugin.NewGeneratedFile(gname, path)
|
||||
|
||||
gfile.P("// Code generated by protoc-gen-go-micro. DO NOT EDIT.")
|
||||
gfile.P("// protoc-gen-go-micro version: " + versionComment)
|
||||
gfile.P("// source: ", file.Proto.GetName())
|
||||
gfile.P("// versions:")
|
||||
gfile.P("// - protoc-gen-go-micro " + versionComment)
|
||||
gfile.P("// - protoc ", protocVersion(plugin))
|
||||
gfile.P("// source: ", file.Desc.Path())
|
||||
gfile.P()
|
||||
gfile.P("package ", file.GoPackageName)
|
||||
gfile.P()
|
||||
@@ -50,3 +54,15 @@ func (g *Generator) microGenerate(component string, plugin *protogen.Plugin, gen
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func protocVersion(plugin *protogen.Plugin) string {
|
||||
v := plugin.Request.GetCompilerVersion()
|
||||
if v == nil {
|
||||
return "(unknown)"
|
||||
}
|
||||
var suffix string
|
||||
if s := v.GetSuffix(); s != "" {
|
||||
suffix = "-" + s
|
||||
}
|
||||
return fmt.Sprintf("v%d.%d.%d%s", v.GetMajor(), v.GetMinor(), v.GetPatch(), suffix)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user