mirror of
https://github.com/kovetskiy/mark.git
synced 2026-05-03 22:12:35 +00:00
refactor: modernize Go primitives
- Replace interface{} with any (Go 1.18) across confluence/api.go,
macro/macro.go, util/cli.go, util/error_handler.go, includes/templates.go
- Replace sort.SliceStable with slices.SortStableFunc + cmp.Compare (Go 1.21)
in attachment/attachment.go, consistent with existing slices usage
- Replace fmt.Errorf("%s", msg) with errors.New(msg) in mark.go
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -13,7 +13,8 @@ import (
|
||||
"net/url"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"sort"
|
||||
"cmp"
|
||||
"slices"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
@@ -235,8 +236,8 @@ func CompileAttachmentLinks(markdown []byte, attachments []Attachment) []byte {
|
||||
// attachments/a.jpg
|
||||
// attachments/a.jpg.jpg
|
||||
// so we replace longer and then shorter
|
||||
sort.SliceStable(replaces, func(i, j int) bool {
|
||||
return len(replaces[i]) > len(replaces[j])
|
||||
slices.SortStableFunc(replaces, func(a, b string) int {
|
||||
return cmp.Compare(len(b), len(a))
|
||||
})
|
||||
|
||||
for _, replace := range replaces {
|
||||
|
||||
Reference in New Issue
Block a user