diff --git a/protoc-gen-go-http/http.go b/protoc-gen-go-http/http.go index 93e9b7c..7aa4673 100644 --- a/protoc-gen-go-http/http.go +++ b/protoc-gen-go-http/http.go @@ -207,16 +207,16 @@ func buildMethodDesc(g *protogen.GeneratedFile, m *protogen.Method, method, path comment = "// " + m.GoName + strings.TrimPrefix(strings.TrimSuffix(comment, "\n"), "//") } return &methodDesc{ - Name: m.GoName, - OriginalName: string(m.Desc.Name()), - Num: methodSets[m.GoName], - Request: g.QualifiedGoIdent(m.Input.GoIdent), - Reply: g.QualifiedGoIdent(m.Output.GoIdent), - Comment: comment, - Comment2: m.Comments.Trailing.String(), - Path: replacePathToGinPath(path), - Method: method, - HasVars: len(vars) > 0, + Name: m.GoName, + OriginalName: string(m.Desc.Name()), + Num: methodSets[m.GoName], + Request: g.QualifiedGoIdent(m.Input.GoIdent), + Reply: g.QualifiedGoIdent(m.Output.GoIdent), + Comment: comment, + OriginalComment: strings.ReplaceAll(comment, string(m.Desc.Name())+" ", ""), + Path: replacePathToGinPath(path), + Method: method, + HasVars: len(vars) > 0, } } diff --git a/protoc-gen-go-http/template.go b/protoc-gen-go-http/template.go index 1d886cf..f8a38e2 100644 --- a/protoc-gen-go-http/template.go +++ b/protoc-gen-go-http/template.go @@ -11,7 +11,7 @@ var httpTemplate = ` {{$svrName := .ServiceName}} {{- range .MethodSets}} -const Route{{$svrType}}{{.OriginalName}} = "{{.Path}}" {{- if ne .Comment2 ""}} {{.Comment2}} {{- end}} +const Route{{$svrType}}{{.OriginalName}} = "{{.Path}}" {{- if ne .OriginalComment ""}} {{.OriginalComment}} {{- end}} {{- end}} type {{.ServiceType}}HTTPServer interface { @@ -102,13 +102,13 @@ type serviceDesc struct { type methodDesc struct { // method - Name string - OriginalName string // The parsed original name - Num int - Request string - Reply string - Comment string - Comment2 string + Name string + OriginalName string // The parsed original name + Num int + Request string + Reply string + Comment string + OriginalComment string // http_rule Path string Method string