From 6ddd4c63c416d8e4afc82e410abe70973837f8a9 Mon Sep 17 00:00:00 2001 From: FynnTang Date: Tue, 29 Aug 2023 18:24:07 +0800 Subject: [PATCH] feat: add Comment2 --- protoc-gen-go-http/http.go | 1 + protoc-gen-go-http/template.go | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/protoc-gen-go-http/http.go b/protoc-gen-go-http/http.go index 44c6b7f..93e9b7c 100644 --- a/protoc-gen-go-http/http.go +++ b/protoc-gen-go-http/http.go @@ -213,6 +213,7 @@ func buildMethodDesc(g *protogen.GeneratedFile, m *protogen.Method, method, path 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, diff --git a/protoc-gen-go-http/template.go b/protoc-gen-go-http/template.go index 0fa96c2..1d886cf 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 .Comment ""}} {{.Comment}} {{- end}} +const Route{{$svrType}}{{.OriginalName}} = "{{.Path}}" {{- if ne .Comment2 ""}} {{.Comment2}} {{- end}} {{- end}} type {{.ServiceType}}HTTPServer interface { @@ -108,6 +108,7 @@ type methodDesc struct { Request string Reply string Comment string + Comment2 string // http_rule Path string Method string