From f64edc4d6dbd02cda988fc1905c495c49c27324b Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Fri, 28 Mar 2025 18:50:44 -0700 Subject: [PATCH] ps: use slices.Contains Signed-off-by: Kir Kolyshkin --- ps.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/ps.go b/ps.go index 4083e559d..0fca65d12 100644 --- a/ps.go +++ b/ps.go @@ -6,6 +6,7 @@ import ( "fmt" "os" "os/exec" + "slices" "strconv" "strings" @@ -86,11 +87,8 @@ var psCommand = cli.Command{ return fmt.Errorf("unable to parse pid: %w", err) } - for _, pid := range pids { - if pid == p { - fmt.Println(line) - break - } + if slices.Contains(pids, p) { + fmt.Println(line) } } return nil