aboutsummaryrefslogtreecommitdiff
path: root/internal/db/webhook_slack.go
diff options
context:
space:
mode:
authordeepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>2022-03-06 16:33:55 +0800
committerGitHub <noreply@github.com>2022-03-06 16:33:55 +0800
commit5afca6ca8eaadebc613dce291da2bae1030ccca9 (patch)
tree46f86403c6abdeabd6172ee5243caa3bfe5a79a4 /internal/db/webhook_slack.go
parentdeec3516d53e9a9679128ade0556ccc818a67be1 (diff)
autofix: function call can be replaced with helper function (#6805)
Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
Diffstat (limited to 'internal/db/webhook_slack.go')
-rw-r--r--internal/db/webhook_slack.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/internal/db/webhook_slack.go b/internal/db/webhook_slack.go
index 289bcb28..adc75587 100644
--- a/internal/db/webhook_slack.go
+++ b/internal/db/webhook_slack.go
@@ -51,18 +51,18 @@ func (p *SlackPayload) JSONPayload() ([]byte, error) {
// see: https://api.slack.com/docs/formatting
func SlackTextFormatter(s string) string {
// replace & < >
- s = strings.Replace(s, "&", "&amp;", -1)
- s = strings.Replace(s, "<", "&lt;", -1)
- s = strings.Replace(s, ">", "&gt;", -1)
+ s = strings.ReplaceAll(s, "&", "&amp;")
+ s = strings.ReplaceAll(s, "<", "&lt;")
+ s = strings.ReplaceAll(s, ">", "&gt;")
return s
}
func SlackShortTextFormatter(s string) string {
s = strings.Split(s, "\n")[0]
// replace & < >
- s = strings.Replace(s, "&", "&amp;", -1)
- s = strings.Replace(s, "<", "&lt;", -1)
- s = strings.Replace(s, ">", "&gt;", -1)
+ s = strings.ReplaceAll(s, "&", "&amp;")
+ s = strings.ReplaceAll(s, "<", "&lt;")
+ s = strings.ReplaceAll(s, ">", "&gt;")
return s
}