From 71dc7f073e50a43a11ab10d3d9ef35ebe5b183f5 Mon Sep 17 00:00:00 2001 From: Aleksa Sarai Date: Thu, 21 Aug 2025 17:40:50 +1000 Subject: [PATCH] unix: switch (*CPUSet).Zero to clear builtin clear was added to Go 1.21 and is better than the manual loop approach. Signed-off-by: Aleksa Sarai --- unix/affinity_linux.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/unix/affinity_linux.go b/unix/affinity_linux.go index 6e5c81acd0..3c7a6d6e2f 100644 --- a/unix/affinity_linux.go +++ b/unix/affinity_linux.go @@ -38,9 +38,7 @@ func SchedSetaffinity(pid int, set *CPUSet) error { // Zero clears the set s, so that it contains no CPUs. func (s *CPUSet) Zero() { - for i := range s { - s[i] = 0 - } + clear(s[:]) } func cpuBitsIndex(cpu int) int {