diff options
Diffstat (limited to 'vendor/github.com/slack-go/slack/slackutilsx/slackutilsx.go')
-rw-r--r-- | vendor/github.com/slack-go/slack/slackutilsx/slackutilsx.go | 6 |
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("&", "&", "<", "<", ">", ">") + // EscapeMessage text func EscapeMessage(message string) string { - replacer := strings.NewReplacer("&", "&", "<", "<", ">", ">") - return replacer.Replace(message) + return escapeReplacer.Replace(message) } // Retryable errors return true. |