From c2085cf8caf8bbac753539911aad7e53dcaacd16 Mon Sep 17 00:00:00 2001 From: david Date: Mon, 20 Dec 2021 18:28:12 +0100 Subject: [PATCH] flip branches for early return Signed-off-by: david --- collector/cpu_linux.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/collector/cpu_linux.go b/collector/cpu_linux.go index a8089c31..933774bc 100644 --- a/collector/cpu_linux.go +++ b/collector/cpu_linux.go @@ -80,11 +80,10 @@ func NewCPUCollector(logger log.Logger) (Collector, error) { isolcpus, err := sysfs.IsolatedCPUs() if err != nil { - if os.IsNotExist(err) { - level.Debug(logger).Log("msg", "Could not open isolated file", "error", err) - } else { + if !os.IsNotExist(err) { return nil, fmt.Errorf("Unable to get isolated cpus: %w", err) } + level.Debug(logger).Log("msg", "Could not open isolated file", "error", err) } c := &cpuCollector{