mirror of
https://github.com/usememos/memos.git
synced 2025-01-27 15:42:16 +08:00
chore: replace util.Min helper with built-in min (#3224)
This commit is contained in:
parent
cb7886dc49
commit
3b550a8ab8
2 changed files with 2 additions and 10 deletions
|
@ -41,13 +41,6 @@ func GenUUID() string {
|
|||
return uuid.New().String()
|
||||
}
|
||||
|
||||
func Min(x, y int) int {
|
||||
if x < y {
|
||||
return x
|
||||
}
|
||||
return y
|
||||
}
|
||||
|
||||
var letters = []rune("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")
|
||||
|
||||
// RandomString returns a random string with length n.
|
||||
|
|
|
@ -13,7 +13,6 @@ import (
|
|||
"github.com/yourselfhosted/gomark/ast"
|
||||
"github.com/yourselfhosted/gomark/renderer"
|
||||
|
||||
"github.com/usememos/memos/internal/util"
|
||||
"github.com/usememos/memos/server/profile"
|
||||
"github.com/usememos/memos/store"
|
||||
)
|
||||
|
@ -102,7 +101,7 @@ func (s *RSSService) generateRSSFromMemoList(ctx context.Context, memoList []*st
|
|||
Created: time.Now(),
|
||||
}
|
||||
|
||||
var itemCountLimit = util.Min(len(memoList), maxRSSItemCount)
|
||||
var itemCountLimit = min(len(memoList), maxRSSItemCount)
|
||||
feed.Items = make([]*feeds.Item, itemCountLimit)
|
||||
for i := 0; i < itemCountLimit; i++ {
|
||||
memo := memoList[i]
|
||||
|
@ -152,7 +151,7 @@ func getRSSItemTitle(content string) string {
|
|||
}
|
||||
|
||||
title := strings.Split(content, "\n")[0]
|
||||
var titleLengthLimit = util.Min(len(title), maxRSSItemTitleLength)
|
||||
var titleLengthLimit = min(len(title), maxRSSItemTitleLength)
|
||||
if titleLengthLimit < len(title) {
|
||||
title = title[:titleLengthLimit] + "..."
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue