From 26209f9d1cbd0faeef306f1da2c43184d489a9a8 Mon Sep 17 00:00:00 2001 From: Andrew Gerrand Date: Tue, 15 Apr 2014 09:48:42 +1000 Subject: go.blog: use !info.Mode().IsRegular() instead of info.Isdir() That way we'll only try to hash regular files. Fixes golang/go#7770. LGTM=bradfitz R=golang-codereviews, bradfitz CC=golang-codereviews https://golang.org/cl/87860043 --- content/pipelines/bounded.go | 2 +- content/pipelines/parallel.go | 2 +- content/pipelines/serial.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'content') diff --git a/content/pipelines/bounded.go b/content/pipelines/bounded.go index 90eed08..3936a29 100644 --- a/content/pipelines/bounded.go +++ b/content/pipelines/bounded.go @@ -25,7 +25,7 @@ func walkFiles(done <-chan struct{}, root string) (<-chan string, <-chan error) if err != nil { return err } - if info.IsDir() { + if !info.Mode().IsRegular() { return nil } select { diff --git a/content/pipelines/parallel.go b/content/pipelines/parallel.go index 7edee1d..e9ad43c 100644 --- a/content/pipelines/parallel.go +++ b/content/pipelines/parallel.go @@ -33,7 +33,7 @@ func sumFiles(done <-chan struct{}, root string) (<-chan result, <-chan error) { if err != nil { return err } - if info.IsDir() { + if !info.Mode().IsRegular() { return nil } wg.Add(1) diff --git a/content/pipelines/serial.go b/content/pipelines/serial.go index 7a44ca1..3afda91 100644 --- a/content/pipelines/serial.go +++ b/content/pipelines/serial.go @@ -18,7 +18,7 @@ func MD5All(root string) (map[string][md5.Size]byte, error) { if err != nil { return err } - if info.IsDir() { + if !info.Mode().IsRegular() { return nil } data, err := ioutil.ReadFile(path) // HL -- cgit v1.2.3