lint: remove unused import

This commit is contained in:
beer-psi 2025-11-02 09:15:04 +07:00
parent bae4c4381f
commit 3988733c31

View File

@ -4,7 +4,6 @@ import (
"context"
"strings"
"time"
"unicode/utf8"
"github.com/Masterminds/squirrel"
"github.com/deluan/rest"
@ -121,8 +120,19 @@ func (r *shareRepositoryWrapper) Save(entity interface{}) (string, error) {
return "", model.ErrNotFound
}
if utf8.RuneCountInString(s.Contents) > 30 {
s.Contents = string([]rune(s.Contents)[:26]) + "..."
var runeCount int
var truncateIndex int
for i := range s.Contents {
runeCount++
if runeCount == 27 {
truncateIndex = i
}
}
if runeCount > 30 {
s.Contents = s.Contents[:truncateIndex] + "..."
}
id, err = r.Persistable.Save(s)