aboutsummaryrefslogtreecommitdiff
path: root/internal/template/template.go
diff options
context:
space:
mode:
authorᴜɴᴋɴᴡᴏɴ <u@gogs.io>2020-03-01 14:55:03 +0800
committerGitHub <noreply@github.com>2020-03-01 14:55:03 +0800
commitf04b2d43509816ecfda93aa5d0d1fd685d9b860f (patch)
tree548c7b0b4ff2f187569e74cf99c19742a44f18aa /internal/template/template.go
parent9c65798902386341a205d52b6b3842e1dc2c751a (diff)
lint: fix some Golang CI lint issues (#5955)
Diffstat (limited to 'internal/template/template.go')
-rw-r--r--internal/template/template.go32
1 files changed, 0 insertions, 32 deletions
diff --git a/internal/template/template.go b/internal/template/template.go
index 1023d7b3..5d254e50 100644
--- a/internal/template/template.go
+++ b/internal/template/template.go
@@ -184,38 +184,6 @@ func ToUTF8WithErr(content []byte) (error, string) {
return err, result
}
-// FIXME: Unused function
-func ToUTF8(content string) string {
- _, res := ToUTF8WithErr([]byte(content))
- return res
-}
-
-// Replaces all prefixes 'old' in 's' with 'new'.
-// FIXME: Unused function
-func ReplaceLeft(s, old, new string) string {
- old_len, new_len, i, n := len(old), len(new), 0, 0
- for ; i < len(s) && strings.HasPrefix(s[i:], old); n += 1 {
- i += old_len
- }
-
- // simple optimization
- if n == 0 {
- return s
- }
-
- // allocating space for the new string
- newLen := n*new_len + len(s[i:])
- replacement := make([]byte, newLen, newLen)
-
- j := 0
- for ; j < n*new_len; j += new_len {
- copy(replacement[j:j+new_len], new)
- }
-
- copy(replacement[j:], s[i:])
- return string(replacement)
-}
-
// RenderCommitMessage renders commit message with special links.
func RenderCommitMessage(full bool, msg, urlPrefix string, metas map[string]string) string {
cleanMsg := template.HTMLEscapeString(msg)