Report the right size to Top
This commit is contained in:
parent
67e51c9f1b
commit
3db212b3c6
2 changed files with 8 additions and 5 deletions
|
@ -221,7 +221,7 @@ func (i *Intermediate) Spawn(maxLevel int) error {
|
||||||
func (i *Intermediate) Collect() error {
|
func (i *Intermediate) Collect() error {
|
||||||
for s := range i.collect {
|
for s := range i.collect {
|
||||||
i.size += s
|
i.size += s
|
||||||
i.refer <- i.size
|
i.refer <- s
|
||||||
}
|
}
|
||||||
close(i.refer)
|
close(i.refer)
|
||||||
return nil
|
return nil
|
||||||
|
@ -330,7 +330,7 @@ func (b *Bottom) Spawn(maxLevel int) error {
|
||||||
func (b *Bottom) Collect() error {
|
func (b *Bottom) Collect() error {
|
||||||
for s := range b.collect {
|
for s := range b.collect {
|
||||||
b.size += s
|
b.size += s
|
||||||
b.refer <- b.size
|
b.refer <- s
|
||||||
}
|
}
|
||||||
close(b.refer)
|
close(b.refer)
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -11,10 +11,13 @@ type RealWalker struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *RealWalker) walkFunc(path string, info os.FileInfo, err error) error {
|
func (r *RealWalker) walkFunc(path string, info os.FileInfo, err error) error {
|
||||||
switch mode := info.Mode(); {
|
if !info.IsDir() {
|
||||||
case mode.IsRegular():
|
switch mode := info.Mode(); {
|
||||||
r.report <- info.Size()
|
case mode.IsRegular():
|
||||||
|
r.report <- info.Size()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue