need to switch to the slices package

This commit is contained in:
Jeff Carr 2024-12-27 14:40:27 -06:00
parent 40830d3f38
commit 4446068e1a
1 changed files with 17 additions and 3 deletions

View File

@ -1,13 +1,27 @@
package gitpb package gitpb
// runs git, parses output
// types faster than you can
import ( import (
"sort" "sort"
"time" "time"
) )
/*
// todo: probably switch to using slices. new things added in 1.23
// https://pkg.go.dev/slices
func (all *GitTags) newSort() *GitTagIterator {
slices.SortFunc(all.GitTags, func(a, b *GitTag) int {
if n := strings.Compare(a.Name, b.Name); n != 0 {
return n
}
// If names are equal, order by age
return cmp.Compare(a.Age, b.Age)
})
}
*/
// all this code below is junk and seamingly wrong
func (all *GitTags) SortByAge() *GitTagIterator { func (all *GitTags) SortByAge() *GitTagIterator {
packs := all.selectAllGitTag() packs := all.selectAllGitTag()