From 20b562ce498f26b2e6684b222257d3edd5fbfebd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Legrand?= Date: Thu, 28 Nov 2024 18:02:18 +0100 Subject: [PATCH] fix go names case --- cmd/avrogo/generate.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cmd/avrogo/generate.go b/cmd/avrogo/generate.go index 46a3683..7fb212f 100644 --- a/cmd/avrogo/generate.go +++ b/cmd/avrogo/generate.go @@ -4,14 +4,15 @@ import ( "bytes" "encoding/json" "fmt" - "golang.org/x/text/cases" - "golang.org/x/text/language" "io" "regexp" "sort" "strconv" "strings" + "golang.org/x/text/cases" + "golang.org/x/text/language" + "github.com/actgardner/gogen-avro/v10/parser" "github.com/actgardner/gogen-avro/v10/schema" ) @@ -425,7 +426,7 @@ func (gc *generateContext) defaultFuncLiteral(v interface{}, t schema.AvroType) func goName(s string) (string, error) { lastIndex := strings.LastIndex(s, ".") name := s[lastIndex+1:] - name = cases.Title(language.Und).String(strings.Trim(name, "_")) + name = cases.Title(language.Und, cases.NoLower).String(strings.Trim(name, "_")) if !isExportedGoIdentifier(name) { return "", fmt.Errorf("cannot form an exported Go identifier from %q", s) }