From 135d3e599c35c6e358dcd051efa34191697ef2cc Mon Sep 17 00:00:00 2001 From: Holger Obermaier <40787752+ho-ob@users.noreply.github.com> Date: Tue, 10 Feb 2026 10:06:32 +0100 Subject: [PATCH] Fix: Loop can be simplified using slices.Contains --- collectors/infinibandMetric.go | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/collectors/infinibandMetric.go b/collectors/infinibandMetric.go index 96ad611..b1f7a5d 100644 --- a/collectors/infinibandMetric.go +++ b/collectors/infinibandMetric.go @@ -10,6 +10,7 @@ package collectors import ( "fmt" "os" + "slices" cclog "github.com/ClusterCockpit/cc-lib/v2/ccLogger" lp "github.com/ClusterCockpit/cc-lib/v2/ccMessage" @@ -113,14 +114,7 @@ func (m *InfinibandCollector) Init(config json.RawMessage) error { port := pathSplit[6] // Skip excluded devices - skip := false - for _, excludedDevice := range m.config.ExcludeDevices { - if excludedDevice == device { - skip = true - break - } - } - if skip { + if slices.Contains(m.config.ExcludeDevices, device) { continue }