1
0
mirror of https://github.com/go-kratos/kratos.git synced 2025-03-17 21:07:54 +02:00

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

This commit is contained in:
包子 2022-03-18 11:33:14 +08:00 committed by GitHub
parent 51fb0e0440
commit de2d4eacda
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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