diff --git a/dynamic_tree.go b/dynamic_tree.go index af23a6a..720268c 100644 --- a/dynamic_tree.go +++ b/dynamic_tree.go @@ -221,7 +221,7 @@ func (i *Intermediate) Spawn(maxLevel int) error { func (i *Intermediate) Collect() error { for s := range i.collect { i.size += s - i.refer <- i.size + i.refer <- s } close(i.refer) return nil @@ -330,7 +330,7 @@ func (b *Bottom) Spawn(maxLevel int) error { func (b *Bottom) Collect() error { for s := range b.collect { b.size += s - b.refer <- b.size + b.refer <- s } close(b.refer) return nil diff --git a/real_walker.go b/real_walker.go index feeef71..e991d15 100644 --- a/real_walker.go +++ b/real_walker.go @@ -11,10 +11,13 @@ type RealWalker struct { } func (r *RealWalker) walkFunc(path string, info os.FileInfo, err error) error { - switch mode := info.Mode(); { - case mode.IsRegular(): - r.report <- info.Size() + if !info.IsDir() { + switch mode := info.Mode(); { + case mode.IsRegular(): + r.report <- info.Size() + } } + return nil }