summaryrefslogtreecommitdiffstats
path: root/modules/templates
diff options
context:
space:
mode:
authorkolaente <konrad@kola-entertainments.de>2019-06-12 21:41:28 +0200
committertechknowlogick <techknowlogick@gitea.io>2019-06-12 15:41:28 -0400
commitf9ec2f89f2265bc1371a6c62359de9816534fa6b (patch)
treef48b138a457e5ac6cf843bbb38400926704370f7 /modules/templates
parent5832f8d90df2d72cb38698c3e9050f2b29717dc7 (diff)
downloadgitea-f9ec2f89f2265bc1371a6c62359de9816534fa6b.tar.gz
gitea-f9ec2f89f2265bc1371a6c62359de9816534fa6b.zip
Add golangci (#6418)
Diffstat (limited to 'modules/templates')
-rw-r--r--modules/templates/dynamic.go10
-rw-r--r--modules/templates/helper.go2
2 files changed, 9 insertions, 3 deletions
diff --git a/modules/templates/dynamic.go b/modules/templates/dynamic.go
index dbd75221d2..d7c04ccb09 100644
--- a/modules/templates/dynamic.go
+++ b/modules/templates/dynamic.go
@@ -83,12 +83,15 @@ func Mailer() *template.Template {
continue
}
- templates.New(
+ _, err = templates.New(
strings.TrimSuffix(
filePath,
".tmpl",
),
).Parse(string(content))
+ if err != nil {
+ log.Warn("Failed to parse template %v", err)
+ }
}
}
}
@@ -113,12 +116,15 @@ func Mailer() *template.Template {
continue
}
- templates.New(
+ _, err = templates.New(
strings.TrimSuffix(
filePath,
".tmpl",
),
).Parse(string(content))
+ if err != nil {
+ log.Warn("Failed to parse template %v", err)
+ }
}
}
}
diff --git a/modules/templates/helper.go b/modules/templates/helper.go
index ef4a68add0..c4551bb4be 100644
--- a/modules/templates/helper.go
+++ b/modules/templates/helper.go
@@ -343,7 +343,7 @@ func ReplaceLeft(s, oldS, newS string) string {
// allocating space for the new string
curLen := n*newLen + len(s[i:])
- replacement := make([]byte, curLen, curLen)
+ replacement := make([]byte, curLen)
j := 0
for ; j < n*newLen; j += newLen {