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 @@ -185,19 +185,16 @@ func ToUpperASCII(s string) string {
185185 return string (b )
186186}
187187
188- var (
189- titleCaser = cases .Title (language .English )
190- titleCaserNoLower = cases .Title (language .English , cases .NoLower )
191- )
192-
193188// ToTitleCase returns s with all english words capitalized
194189func 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 )
196192}
197193
198- // ToTitleCaseNoLower returns s with all english words capitalized without lowercasing
194+ // ToTitleCaseNoLower returns s with all english words capitalized without lower-casing
199195func 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 )
201198}
202199
203200var (
You can’t perform that action at this time.
0 commit comments