Replacing usages of fmt.Sprint with faster alternatives

Signed-off-by: Philippe Antoine <contact@catenacyber.fr>
Этот коммит содержится в:
Catena cyber
2023-11-03 11:18:18 +01:00
коммит произвёл GitHub
родитель 43f4734eae
Коммит 04e7b6bc9e
8 изменённых файлов: 21 добавлений и 19 удалений

Просмотреть файл

@@ -9,6 +9,7 @@ import (
"html"
"html/template"
"io"
"strconv"
"strings"
"time"
@@ -343,9 +344,9 @@ func getFormattedPostTime(user *model.User, post *model.Post, useMilitaryTime bo
return formattedPostTime{
Time: localTime,
Year: fmt.Sprintf("%d", localTime.Year()),
Year: strconv.Itoa(localTime.Year()),
Month: translateFunc(localTime.Month().String()),
Day: fmt.Sprintf("%d", localTime.Day()),
Day: strconv.Itoa(localTime.Day()),
Hour: hour,
Minute: fmt.Sprintf("%02d"+period, localTime.Minute()),
TimeZone: zone,

Просмотреть файл

@@ -5,6 +5,7 @@ package platform
import (
"fmt"
"strconv"
"time"
"github.com/mattermost/mattermost/server/public/model"
@@ -229,7 +230,7 @@ func (ps *PlatformService) UpdateSessionsIsGuest(c request.CTX, userID string, i
}
for _, session := range sessions {
session.AddProp(model.SessionPropIsGuest, fmt.Sprintf("%t", isGuest))
session.AddProp(model.SessionPropIsGuest, strconv.FormatBool(isGuest))
err := ps.Store.Session().UpdateProps(session)
if err != nil {
mlog.Warn("Unable to update isGuest session", mlog.Err(err))