From 3e836ce23e2cc90ad3f16de47393a31b96052099 Mon Sep 17 00:00:00 2001 From: "Serge A. Zaitsev" Date: Sat, 27 Jun 2015 06:00:05 +0300 Subject: [PATCH] checking errors in fs walk --- usb_linux.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/usb_linux.go b/usb_linux.go index 90d3e31..9deba79 100644 --- a/usb_linux.go +++ b/usb_linux.go @@ -266,8 +266,8 @@ func walker(path string, cb func(Device)) error { } func UsbWalk(cb func(Device)) { - filepath.Walk(DevBusUsb, func(f string, fi os.FileInfo, _ error) error { - if fi.IsDir() { + filepath.Walk(DevBusUsb, func(f string, fi os.FileInfo, err error) error { + if err != nil || fi.IsDir() { return nil } if err := walker(f, cb); err != nil {