diff options
author | KN4CK3R <admin@oldschoolhack.me> | 2021-08-09 20:08:51 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-09 14:08:51 -0400 |
commit | d9ef43a7126ab83af563c1c9b54cdf0092327b2a (patch) | |
tree | fabc9a9d24d42bb0de6dd9557c9e07e95bd5722b /modules/templates/helper.go | |
parent | 23d438f56524a7c3fc185df66d6d95f797a80eee (diff) | |
download | gitea-d9ef43a7126ab83af563c1c9b54cdf0092327b2a.tar.gz gitea-d9ef43a7126ab83af563c1c9b54cdf0092327b2a.zip |
Replace `list.List` with slices (#16311)
* Replaced list with slice.
* Fixed usage of pointer to temporary variable.
* Replaced LIFO list with slice.
* Lint
* Removed type check.
* Removed duplicated code.
* Lint
* Fixed merge.
Co-authored-by: 6543 <6543@obermui.de>
Diffstat (limited to 'modules/templates/helper.go')
-rw-r--r-- | modules/templates/helper.go | 29 |
1 files changed, 0 insertions, 29 deletions
diff --git a/modules/templates/helper.go b/modules/templates/helper.go index 1e8f00b669..6517127ebf 100644 --- a/modules/templates/helper.go +++ b/modules/templates/helper.go @@ -7,7 +7,6 @@ package templates import ( "bytes" - "container/list" "errors" "fmt" "html" @@ -126,7 +125,6 @@ func NewFuncMap() []template.FuncMap { }, "SizeFmt": base.FileSize, "CountFmt": base.FormatNumberSI, - "List": List, "SubStr": func(str string, start, length int) string { if len(str) == 0 { return "" @@ -297,18 +295,6 @@ func NewFuncMap() []template.FuncMap { }, "CommentMustAsDiff": gitdiff.CommentMustAsDiff, "MirrorRemoteAddress": mirrorRemoteAddress, - "CommitType": func(commit interface{}) string { - switch commit.(type) { - case models.SignCommitWithStatuses: - return "SignCommitWithStatuses" - case models.SignCommit: - return "SignCommit" - case models.UserCommit: - return "UserCommit" - default: - return "" - } - }, "NotificationSettings": func() map[string]interface{} { return map[string]interface{}{ "MinTimeout": int(setting.UI.Notification.MinTimeout / time.Millisecond), @@ -428,7 +414,6 @@ func NewTextFuncMap() []texttmpl.FuncMap { "DateFmtShort": func(t time.Time) string { return t.Format("Jan 02, 2006") }, - "List": List, "SubStr": func(str string, start, length int) string { if len(str) == 0 { return "" @@ -636,20 +621,6 @@ func JSEscape(raw string) string { return template.JSEscapeString(raw) } -// List traversings the list -func List(l *list.List) chan interface{} { - e := l.Front() - c := make(chan interface{}) - go func() { - for e != nil { - c <- e.Value - e = e.Next() - } - close(c) - }() - return c -} - // Sha1 returns sha1 sum of string func Sha1(str string) string { return base.EncodeSha1(str) |