From 3b48371b490f2c55877e0d51982aa400c94c38a5 Mon Sep 17 00:00:00 2001 From: Ted Unangst Date: Wed, 22 Apr 2020 18:31:33 -0400 Subject: [PATCH] combine a common fmt string --- fun.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/fun.go b/fun.go index c6809ac..2ec4d99 100644 --- a/fun.go +++ b/fun.go @@ -454,18 +454,17 @@ func fullname(name string, userid int64) string { } func mentionize(s string) string { + fill := `%s` s = re_mentions.ReplaceAllStringFunc(s, func(m string) string { where := gofish(m) if where == "" { return m } who := m[0 : 1+strings.IndexByte(m[1:], '@')] - return fmt.Sprintf(`%s`, - html.EscapeString(where), html.EscapeString(who)) + return fmt.Sprintf(fill, html.EscapeString(where), html.EscapeString(who)) }) s = re_urltions.ReplaceAllStringFunc(s, func(m string) string { - return fmt.Sprintf(`%s`, - html.EscapeString(m[1:]), html.EscapeString(m)) + return fmt.Sprintf(fill, html.EscapeString(m[1:]), html.EscapeString(m)) }) return s }