Skip to content

fix: strings.Title -> cases.Title bcs strings.Title library is deprecated#6999

Merged
jinzhu merged 3 commits intogo-gorm:masterfrom
ryuji-cre8ive:fix/title-lib
Jun 12, 2024
Merged

fix: strings.Title -> cases.Title bcs strings.Title library is deprecated#6999
jinzhu merged 3 commits intogo-gorm:masterfrom
ryuji-cre8ive:fix/title-lib

Conversation

@ryuji-cre8ive
Copy link
Copy Markdown
Contributor

  • Do only one thing
  • Non breaking API changes
  • Tested

What did this pull request do?

change using library strings.Title to cases.Title because of strings. Title is deprecated for Go 1.18
below is a warnings when I run golangci-cli:

strings.Title has been deprecated since Go 1.18 and an alternative has been available since Go 1.0: The rule Title uses for word boundaries does not handle Unicode punctuation properly. Use golang.org/x/text/cases instead.

I rewrite strings.Title -> cases.Title.
cases.TItle returns a Caser so it needed to parse to string because strings.Title returns string

cases.Title can be taken language, but I don't know which language supports for gorm so I tried to write language.Und.
this means you didn't decide which language.

User Case Description

Copy link
Copy Markdown
Contributor

@daheige daheige left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use golang.org/x/text/cases LGTM

@jinzhu jinzhu merged commit 0f105ec into go-gorm:master Jun 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants