File tree Expand file tree Collapse file tree 1 file changed +5
-8
lines changed Expand file tree Collapse file tree 1 file changed +5
-8
lines changed Original file line number Diff line number Diff line change @@ -186,19 +186,16 @@ func ToUpperASCII(s string) string {
186186 return string (b )
187187}
188188
189- var (
190- titleCaser = cases .Title (language .English )
191- titleCaserNoLower = cases .Title (language .English , cases .NoLower )
192- )
193-
194189// ToTitleCase returns s with all english words capitalized
195190func ToTitleCase (s string ) string {
196- return titleCaser .String (s )
191+ // `cases.Title` is not thread-safe, do not use global shared variable for it
192+ return cases .Title (language .English ).String (s )
197193}
198194
199- // ToTitleCaseNoLower returns s with all english words capitalized without lowercasing
195+ // ToTitleCaseNoLower returns s with all english words capitalized without lower-casing
200196func ToTitleCaseNoLower (s string ) string {
201- return titleCaserNoLower .String (s )
197+ // `cases.Title` is not thread-safe, do not use global shared variable for it
198+ return cases .Title (language .English , cases .NoLower ).String (s )
202199}
203200
204201func logError (msg string , args ... any ) {
You can’t perform that action at this time.
0 commit comments