diff --git a/cmd/protoc-gen-go-http/http.go b/cmd/protoc-gen-go-http/http.go index fe0303e6e..25c443209 100644 --- a/cmd/protoc-gen-go-http/http.go +++ b/cmd/protoc-gen-go-http/http.go @@ -177,10 +177,8 @@ func buildPathVars(method *protogen.Method, path string) (res []string) { } func camelCaseVars(s string) string { - var ( - vars []string - subs = strings.Split(s, ".") - ) + vars := make([]string, 0) + subs := strings.Split(s, ".") for _, sub := range subs { vars = append(vars, camelCase(sub)) } diff --git a/cmd/protoc-gen-go-http/template.go b/cmd/protoc-gen-go-http/template.go index 32fae69ab..2c34647b0 100644 --- a/cmd/protoc-gen-go-http/template.go +++ b/cmd/protoc-gen-go-http/template.go @@ -124,5 +124,5 @@ func (s *serviceDesc) execute() string { if err := tmpl.Execute(buf, s); err != nil { panic(err) } - return strings.Trim(string(buf.Bytes()), "\r\n") + return strings.Trim(buf.String(), "\r\n") } diff --git a/hack/.lintcheck_failures b/hack/.lintcheck_failures index ecb6a9d08..099609775 100644 --- a/hack/.lintcheck_failures +++ b/hack/.lintcheck_failures @@ -1,5 +1,4 @@ ./examples -./cmd/protoc-gen-go-http ./cmd/kratos ./contrib/metrics/datadog ./contrib/config/nacos