fix(cmd): proto-gen-go-http warn only when ending with a slash (#1887)

status-code-override
包子 3 years ago committed by chenzhihui
parent 1bb7e377e5
commit b80835a131
  1. 3
      cmd/protoc-gen-go-http/http.go

@ -204,8 +204,7 @@ func buildMethodDesc(g *protogen.GeneratedFile, m *protogen.Method, method, path
func buildPathVars(path string) (res map[string]*string) { func buildPathVars(path string) (res map[string]*string) {
if strings.HasSuffix(path, "/") { if strings.HasSuffix(path, "/") {
fmt.Fprintf(os.Stderr, "\u001B[31mERROR\u001B[m: Path %s should not end with \"/\" \n", path) fmt.Fprintf(os.Stderr, "\u001B[31mWARN\u001B[m: Path %s should not end with \"/\" \n", path)
os.Exit(2)
} }
res = make(map[string]*string) res = make(map[string]*string)
pattern := regexp.MustCompile(`(?i){([a-z\.0-9_\s]*)=?([^{}]*)}`) pattern := regexp.MustCompile(`(?i){([a-z\.0-9_\s]*)=?([^{}]*)}`)

Loading…
Cancel
Save