Skip to content
9 changes: 9 additions & 0 deletions sysfs/class_fibrechannel.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,15 @@
var counters FibreChannelCounters

path := filepath.Join(hostPath, "statistics")

if _, err := os.Stat(path); err != nil {
if errors.Is(err, fs.ErrNotExist) {

Check failure on line 157 in sysfs/class_fibrechannel.go

View workflow job for this annotation

GitHub Actions / Test (windows, 1.25.x)

undefined: fs (typecheck)

Check failure on line 157 in sysfs/class_fibrechannel.go

View workflow job for this annotation

GitHub Actions / Test (linux, 1.25.x)

undefined: fs (typecheck)

Check failure on line 157 in sysfs/class_fibrechannel.go

View workflow job for this annotation

GitHub Actions / lint

undefined: fs (typecheck)
// statistics directory not present, skip
return &counters, nil
}
return nil, err
}

files, err := os.ReadDir(path)
if err != nil {
Comment thread
chijiajian marked this conversation as resolved.
return nil, err
Expand Down
Loading