From 5cbea23799da1e7d8d7c4bfd595df668b26b5a63 Mon Sep 17 00:00:00 2001 From: Alexandre Boucey Date: Tue, 22 May 2018 09:51:39 +0200 Subject: [PATCH] Fixed race exception on SanitizeKey --- util.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/util.go b/util.go index 445a097..dc0f3e0 100644 --- a/util.go +++ b/util.go @@ -20,9 +20,9 @@ var secondRegex = regexp.MustCompile(`(?P[0-9]+(?:\.[0-9]+)?) seconds?`) var percentRegex = regexp.MustCompile(`(?P[0-9]{1,3})\s?%`) var pluralizerRegex = regexp.MustCompile(`(?P_|[^a-z]|^)(?Pblow|boost|kill|assist|barrier|hit|multikill|elimination)(?P$|[^a-z])`) -var t = transform.Chain(norm.NFD, runes.Remove(runes.In(unicode.Mn)), norm.NFC) - func SanitizeKey(text string) string { + var t = transform.Chain(norm.NFD, runes.Remove(runes.In(unicode.Mn)), norm.NFC) + text = strings.ToLower(text) text, _, _ = transform.String(t, text) text = spaceRegex.ReplaceAllString(text, "_")