1
0
Fork 0
mirror of https://github.com/Eggbertx/gochan.git synced 2025-08-27 07:26:22 -07:00

Fix anti-patterns pointed out by DeepSource

But not the switch fallthroughs/expression lists, there's no benefit
This commit is contained in:
Eggbertx 2020-07-09 15:54:31 -07:00
parent 497a3925e0
commit 55317504a1
17 changed files with 53 additions and 67 deletions

View file

@ -60,10 +60,8 @@ var funcMap = template.FuncMap{
// String functions
// "arrToString": arrToString,
"intToString": strconv.Itoa,
"escapeString": func(a string) string {
return html.EscapeString(a)
},
"intToString": strconv.Itoa,
"escapeString": html.EscapeString,
"formatFilesize": func(sizeInt int) string {
size := float32(sizeInt)
if size < 1000 {
@ -87,7 +85,7 @@ var funcMap = template.FuncMap{
},
"truncateMessage": func(msg string, limit int, maxLines int) string {
var truncated bool
split := strings.SplitN(msg, "<br />", -1)
split := strings.Split(msg, "<br />")
if len(split) > maxLines {
split = split[:maxLines]