From 694e78ca345fd1e209be1d40b0a2cc4c6f8b7bb3 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 24 Feb 2026 16:29:48 +0000 Subject: [PATCH] =?UTF-8?q?chore:=20sort.Slice=20=E2=86=92=20slices.SortFu?= =?UTF-8?q?nc?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.6 --- internal/metal/batch.go | 10 +++++----- internal/metal/lora.go | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/internal/metal/batch.go b/internal/metal/batch.go index 3c5c04e..09c32ae 100644 --- a/internal/metal/batch.go +++ b/internal/metal/batch.go @@ -3,11 +3,11 @@ package metal import ( + "cmp" "context" "fmt" "math" "slices" - "sort" "time" ) @@ -49,8 +49,8 @@ func (m *Model) Classify(ctx context.Context, prompts []string, cfg GenerateConf for i := range indices { indices[i] = i } - sort.Slice(indices, func(a, b int) bool { - return lengths[indices[a]] > lengths[indices[b]] + slices.SortFunc(indices, func(a, b int) int { + return cmp.Compare(lengths[b], lengths[a]) }) maxLen := lengths[indices[0]] @@ -160,8 +160,8 @@ func (m *Model) BatchGenerate(ctx context.Context, prompts []string, cfg Generat for i := range indices { indices[i] = i } - sort.Slice(indices, func(a, b int) bool { - return lengths[indices[a]] > lengths[indices[b]] + slices.SortFunc(indices, func(a, b int) int { + return cmp.Compare(lengths[b], lengths[a]) }) N := int32(len(prompts)) diff --git a/internal/metal/lora.go b/internal/metal/lora.go index 8d080b2..aab49c4 100644 --- a/internal/metal/lora.go +++ b/internal/metal/lora.go @@ -15,7 +15,7 @@ import ( "math" "os" "path/filepath" - "sort" + "slices" "strings" "unsafe" ) @@ -156,7 +156,7 @@ func (a *LoRAAdapter) SortedNames() []string { for name := range a.Layers { names = append(names, name) } - sort.Strings(names) + slices.Sort(names) return names }