From 7815e482f314ef4af97946698b94857a2bdffff2 Mon Sep 17 00:00:00 2001 From: songzhibin97 <49082129+songzhibin97@users.noreply.github.com> Date: Sun, 22 May 2022 09:45:16 +0800 Subject: [PATCH] stype:gen_go_errors (#2026) * Update errors.go * Update errors.go --- cmd/protoc-gen-go-errors/errors.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/cmd/protoc-gen-go-errors/errors.go b/cmd/protoc-gen-go-errors/errors.go index 9e8e02ad1..724dc1add 100644 --- a/cmd/protoc-gen-go-errors/errors.go +++ b/cmd/protoc-gen-go-errors/errors.go @@ -47,8 +47,7 @@ func generateFileContent(gen *protogen.Plugin, file *protogen.File, g *protogen. g.P() index := 0 for _, enum := range file.Enums { - skip := genErrorsReason(gen, file, g, enum) - if !skip { + if !genErrorsReason(gen, file, g, enum) { index++ } } @@ -108,8 +107,7 @@ func genErrorsReason(gen *protogen.Plugin, file *protogen.File, g *protogen.Gene func case2Camel(name string) string { if !strings.Contains(name, "_") { - upperName := strings.ToUpper(name) - if upperName == name { + if name == strings.ToUpper(name) { name = strings.ToLower(name) } return enCases.String(name)