From eb4546c11a2d48d4c2a9a80e7e48ed4d52a7c6a6 Mon Sep 17 00:00:00 2001 From: FynnTang Date: Mon, 4 Sep 2023 14:35:10 +0800 Subject: [PATCH] feat: remove permissionCode --- protoc-gen-go-http/http.go | 8 ++------ protoc-gen-go-http/template.go | 5 ----- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/protoc-gen-go-http/http.go b/protoc-gen-go-http/http.go index 49fe4bd..f81609f 100644 --- a/protoc-gen-go-http/http.go +++ b/protoc-gen-go-http/http.go @@ -85,13 +85,9 @@ func genService(_ *protogen.Plugin, file *protogen.File, g *protogen.GeneratedFi rule, ok := proto.GetExtension(method.Desc.Options(), annotations.E_Http).(*annotations.HttpRule) if rule != nil && ok { for _, bind := range rule.AdditionalBindings { - md := buildHTTPRule(g, method, bind) - sd.Methods = append(sd.Methods, md) - sd.PermissionCodes = append(sd.PermissionCodes, md.PermissionCodes...) + sd.Methods = append(sd.Methods, buildHTTPRule(g, method, bind)) } - md := buildHTTPRule(g, method, rule) - sd.Methods = append(sd.Methods, md) - sd.PermissionCodes = append(sd.PermissionCodes, md.PermissionCodes...) + sd.Methods = append(sd.Methods, buildHTTPRule(g, method, rule)) } else if !omitempty { path := fmt.Sprintf("/%s/%s", service.Desc.FullName(), method.Desc.Name()) sd.Methods = append(sd.Methods, buildMethodDesc(g, method, http.MethodPost, path)) diff --git a/protoc-gen-go-http/template.go b/protoc-gen-go-http/template.go index da17e60..01c5274 100644 --- a/protoc-gen-go-http/template.go +++ b/protoc-gen-go-http/template.go @@ -10,11 +10,6 @@ var httpTemplate = ` {{$svrType := .ServiceType}} {{$svrName := .ServiceName}} -{{- range .PermissionCodes}} - const PermissionCode{{.Name}} = "{{.Code}}" -{{- end}} -// - {{- range .MethodSets}} const Route{{$svrType}}{{.OriginalName}} = "{{.Path}}" {{- if ne .OriginalComment ""}} {{.OriginalComment}} {{.Method}}{{- end}} {{- end}}