[tools] Fix panic in glob.Scan with non-existent path
Fixed: tint:2160
Change-Id: I21c5fc96b5d849134064c7026e6762e348d3b5fc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/172862
Kokoro: Kokoro <noreply+kokoro@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: James Price <jrprice@google.com>
diff --git a/tools/src/glob/glob.go b/tools/src/glob/glob.go
index 94648d3..dc55933 100644
--- a/tools/src/glob/glob.go
+++ b/tools/src/glob/glob.go
@@ -82,6 +82,10 @@
func Scan(root string, cfg Config) ([]string, error) {
files := []string{}
err := filepath.Walk(root, func(path string, info os.FileInfo, err error) error {
+ if err != nil {
+ return err
+ }
+
rel, err := filepath.Rel(root, path)
if err != nil {
rel = path