From 4446068e1adf072a90039e5293e31da0d7a9b3a3 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Fri, 27 Dec 2024 14:40:27 -0600 Subject: [PATCH] need to switch to the slices package --- gitTag.byAge.go | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/gitTag.byAge.go b/gitTag.byAge.go index eacf757..8fa52e9 100644 --- a/gitTag.byAge.go +++ b/gitTag.byAge.go @@ -1,13 +1,27 @@ package gitpb -// runs git, parses output -// types faster than you can - import ( "sort" "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 { packs := all.selectAllGitTag()