From cd554b0af706b5f62b4e1bfde04091052b4aac61 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Wed, 18 Mar 2026 20:54:35 +0200 Subject: cleanup --- internal/tui/pidpicker/proclist.go | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'internal/tui/pidpicker') diff --git a/internal/tui/pidpicker/proclist.go b/internal/tui/pidpicker/proclist.go index 20e580d..73ff209 100644 --- a/internal/tui/pidpicker/proclist.go +++ b/internal/tui/pidpicker/proclist.go @@ -2,11 +2,12 @@ package pidpicker import ( "bytes" + "cmp" "fmt" "io/fs" "os" "path/filepath" - "sort" + "slices" "strconv" "strings" "sync" @@ -50,8 +51,8 @@ func scanProcessesFrom(procRoot string) ([]ProcessInfo, error) { processes = append(processes, process) } - sort.Slice(processes, func(i, j int) bool { - return processes[i].Pid < processes[j].Pid + slices.SortFunc(processes, func(a, b ProcessInfo) int { + return cmp.Compare(a.Pid, b.Pid) }) return processes, nil } @@ -145,8 +146,8 @@ func scanThreadsFrom(procRoot string, pid int) ([]ProcessInfo, error) { threads = append(threads, thread) } - sort.Slice(threads, func(i, j int) bool { - return threads[i].Pid < threads[j].Pid + slices.SortFunc(threads, func(a, b ProcessInfo) int { + return cmp.Compare(a.Pid, b.Pid) }) return threads, nil } @@ -209,11 +210,11 @@ func scanAllThreadsFrom(procRoot string) ([]ProcessInfo, error) { } wg.Wait() - sort.Slice(threads, func(i, j int) bool { - if threads[i].Pid == threads[j].Pid { - return threads[i].ParentPID < threads[j].ParentPID + slices.SortFunc(threads, func(a, b ProcessInfo) int { + if a.Pid != b.Pid { + return cmp.Compare(a.Pid, b.Pid) } - return threads[i].Pid < threads[j].Pid + return cmp.Compare(a.ParentPID, b.ParentPID) }) return threads, nil } -- cgit v1.2.3