Fix all linter warnings

This commit is contained in:
Holger Obermaier
2026-03-05 14:37:23 +01:00
parent b241c2cd66
commit 03e7077543

View File

@@ -2,6 +2,7 @@ package collectors
import ( import (
"encoding/json" "encoding/json"
"fmt"
"os/exec" "os/exec"
"time" "time"
@@ -38,7 +39,7 @@ func (m *SmartMonCollector) getSmartmonDevices() error {
} else { } else {
command = exec.Command(m.smartCtlCmd, "--scan", "-j") command = exec.Command(m.smartCtlCmd, "--scan", "-j")
} }
command.Wait()
stdout, err := command.Output() stdout, err := command.Output()
if err != nil { if err != nil {
return err return err
@@ -59,7 +60,9 @@ func (m *SmartMonCollector) getSmartmonDevices() error {
func (m *SmartMonCollector) Init(config json.RawMessage) error { func (m *SmartMonCollector) Init(config json.RawMessage) error {
var err error = nil var err error = nil
m.name = "SmartMonCollector" m.name = "SmartMonCollector"
m.setup() if err := m.setup(); err != nil {
return fmt.Errorf("%s Init(): setup() call failed: %w", m.name, err)
}
m.parallel = true m.parallel = true
m.meta = map[string]string{"source": m.name, "group": "Disk"} m.meta = map[string]string{"source": m.name, "group": "Disk"}
m.tags = map[string]string{"type": "node", "stype": "disk"} m.tags = map[string]string{"type": "node", "stype": "disk"}
@@ -126,7 +129,7 @@ func (m *SmartMonCollector) Read(interval time.Duration, output chan lp.CCMessag
} else { } else {
command = exec.Command(m.smartCtlCmd, "-j", "-a", d) command = exec.Command(m.smartCtlCmd, "-j", "-a", d)
} }
command.Wait()
stdout, err := command.Output() stdout, err := command.Output()
if err != nil { if err != nil {
cclog.ComponentError(m.name, "cannot read data for device", d) cclog.ComponentError(m.name, "cannot read data for device", d)
@@ -212,7 +215,6 @@ func (m *SmartMonCollector) Read(interval time.Duration, output chan lp.CCMessag
output <- y output <- y
} }
} }
} }
func (m *SmartMonCollector) Close() { func (m *SmartMonCollector) Close() {