Skip to content

Commit

Permalink
fix go names case
Browse files Browse the repository at this point in the history
  • Loading branch information
clement-heetch committed Nov 28, 2024
1 parent eaf42ab commit 20b562c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions cmd/avrogo/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down Expand Up @@ -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)
}
Expand Down

0 comments on commit 20b562c

Please sign in to comment.