chore(go.d/nvme): fix :dog: warning (#19510)
Ilya Mashchenko committed
Jan 28, 2025 at 21:36 UTC
5e23dfa9f09de8a3150140a1afa4c904afe34d8f
1 file changed
+4
-6
src/go/plugin/go.d/collector/nvme/exec.go
+4
-6
@@ -29,14 +29,12 @@ func (n *nvmeDeviceList) UnmarshalJSON(b []byte) error {
29
return err
30
}
31
32
- for _, d := range n.Devices {
33
- if d.DevicePath != "" {
34
- return nil
35
- }
36
- n.Devices = n.Devices[:0]
37
- break
32
+ if len(n.Devices) > 0 && n.Devices[0].DevicePath != "" {
33
+ return nil
34
}
35
36
+ n.Devices = n.Devices[:0]
37
+
38
var v211Format struct {
39
Devices []struct {
40
Subsystems []struct {