File tree 1 file changed +5
-8
lines changed 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 {
186
186
return string (b )
187
187
}
188
188
189
- var (
190
- titleCaser = cases .Title (language .English )
191
- titleCaserNoLower = cases .Title (language .English , cases .NoLower )
192
- )
193
-
194
189
// ToTitleCase returns s with all english words capitalized
195
190
func 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 )
197
193
}
198
194
199
- // ToTitleCaseNoLower returns s with all english words capitalized without lowercasing
195
+ // ToTitleCaseNoLower returns s with all english words capitalized without lower-casing
200
196
func 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 )
202
199
}
203
200
204
201
func logError (msg string , args ... any ) {
You can’t perform that action at this time.
0 commit comments