summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/slack-go/slack/slackutilsx/slackutilsx.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/slack-go/slack/slackutilsx/slackutilsx.go')
-rw-r--r--vendor/github.com/slack-go/slack/slackutilsx/slackutilsx.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/vendor/github.com/slack-go/slack/slackutilsx/slackutilsx.go b/vendor/github.com/slack-go/slack/slackutilsx/slackutilsx.go
index 1f7b2b8c..d6c9c07e 100644
--- a/vendor/github.com/slack-go/slack/slackutilsx/slackutilsx.go
+++ b/vendor/github.com/slack-go/slack/slackutilsx/slackutilsx.go
@@ -50,10 +50,12 @@ func DetectChannelType(channelID string) ChannelType {
}
}
+// initialize replacer only once (if needed)
+var escapeReplacer = strings.NewReplacer("&", "&amp;", "<", "&lt;", ">", "&gt;")
+
// EscapeMessage text
func EscapeMessage(message string) string {
- replacer := strings.NewReplacer("&", "&amp;", "<", "&lt;", ">", "&gt;")
- return replacer.Replace(message)
+ return escapeReplacer.Replace(message)
}
// Retryable errors return true.