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 @@ -185,19 +185,16 @@ func ToUpperASCII(s string) string {
185
185
return string (b )
186
186
}
187
187
188
- var (
189
- titleCaser = cases .Title (language .English )
190
- titleCaserNoLower = cases .Title (language .English , cases .NoLower )
191
- )
192
-
193
188
// ToTitleCase returns s with all english words capitalized
194
189
func ToTitleCase (s string ) string {
195
- return titleCaser .String (s )
190
+ // `cases.Title` is not thread-safe, do not use global shared variable for it
191
+ return cases .Title (language .English ).String (s )
196
192
}
197
193
198
- // ToTitleCaseNoLower returns s with all english words capitalized without lowercasing
194
+ // ToTitleCaseNoLower returns s with all english words capitalized without lower-casing
199
195
func ToTitleCaseNoLower (s string ) string {
200
- return titleCaserNoLower .String (s )
196
+ // `cases.Title` is not thread-safe, do not use global shared variable for it
197
+ return cases .Title (language .English , cases .NoLower ).String (s )
201
198
}
202
199
203
200
var (
You can’t perform that action at this time.
0 commit comments