Report the right size to Top

This commit is contained in:
Blallo 2020-03-03 14:16:54 +01:00
parent 67e51c9f1b
commit 3db212b3c6
No known key found for this signature in database
GPG key ID: 0CBE577C9B72DC3F
2 changed files with 8 additions and 5 deletions

View file

@ -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

View file

@ -11,10 +11,13 @@ type RealWalker struct {
}
func (r *RealWalker) walkFunc(path string, info os.FileInfo, err error) error {
if !info.IsDir() {
switch mode := info.Mode(); {
case mode.IsRegular():
r.report <- info.Size()
}
}
return nil
}