From e67768bcf65b9641964d740dca625901454e2a77 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Sun, 3 Nov 2024 09:24:16 +0100 Subject: [PATCH] Use separate function for better code readability --- main.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/main.go b/main.go index 0ceeadf..08c9a56 100644 --- a/main.go +++ b/main.go @@ -167,10 +167,12 @@ func netnsPids(netns string) []int { log.Fatalf("failed to run %q: %v", xargs, err) } - var res []int - xs := strings.FieldsFunc(string(out), func(c rune) bool { + isNewline := func(c rune) bool { return c == '\n' - }) + } + + var res []int + xs := strings.FieldsFunc(string(out), isNewline) for _, x := range xs { y, err := strconv.Atoi(x) if err != nil { -- 2.45.2