Skip to content

Commit

Permalink
revert: revert #1544 (#1548)
Browse files Browse the repository at this point in the history
  • Loading branch information
shenqidebaozi authored Oct 14, 2021
1 parent 3d23d29 commit 872d313
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cmd/protoc-gen-go-errors/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func genErrorsReason(gen *protogen.Plugin, file *protogen.File, g *protogen.Gene
err := &errorInfo{
Name: string(enum.Desc.Name()),
Value: string(v.Desc.Name()),
CamelValue: Case2Camel(string(v.Desc.Name())),
CamelValue: case2Camel(string(v.Desc.Name())),
HTTPCode: enumCode,
}
ew.Errors = append(ew.Errors, err)
Expand All @@ -92,9 +92,9 @@ func genErrorsReason(gen *protogen.Plugin, file *protogen.File, g *protogen.Gene
return false
}

func Case2Camel(name string) string {
func case2Camel(name string) string {
if !strings.Contains(name, "_") {
return strings.Title(strings.ToLower(name))
return name
}
name = strings.ToLower(name)
name = strings.Replace(name, "_", " ", -1)
Expand Down

0 comments on commit 872d313

Please sign in to comment.