revert: revert #1544 (#1548)

pull/1553/head v2.1.0
包子 3 years ago committed by GitHub
parent 3d23d295c4
commit 872d31343a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      cmd/protoc-gen-go-errors/errors.go

@ -80,7 +80,7 @@ func genErrorsReason(gen *protogen.Plugin, file *protogen.File, g *protogen.Gene
err := &errorInfo{ err := &errorInfo{
Name: string(enum.Desc.Name()), Name: string(enum.Desc.Name()),
Value: string(v.Desc.Name()), Value: string(v.Desc.Name()),
CamelValue: Case2Camel(string(v.Desc.Name())), CamelValue: case2Camel(string(v.Desc.Name())),
HTTPCode: enumCode, HTTPCode: enumCode,
} }
ew.Errors = append(ew.Errors, err) ew.Errors = append(ew.Errors, err)
@ -92,9 +92,9 @@ func genErrorsReason(gen *protogen.Plugin, file *protogen.File, g *protogen.Gene
return false return false
} }
func Case2Camel(name string) string { func case2Camel(name string) string {
if !strings.Contains(name, "_") { if !strings.Contains(name, "_") {
return strings.Title(strings.ToLower(name)) return name
} }
name = strings.ToLower(name) name = strings.ToLower(name)
name = strings.Replace(name, "_", " ", -1) name = strings.Replace(name, "_", " ", -1)

Loading…
Cancel
Save