lib/fs: Use gopsutils for disk usage (#5905)

This commit is contained in:
Simon Frei 2019-07-29 20:06:17 +02:00 committed by Jakob Borg
parent 710f5c199f
commit 1d182e4631
3 changed files with 8 additions and 8 deletions

1
go.mod
View File

@ -5,7 +5,6 @@ require (
github.com/AudriusButkevicius/pfilter v0.0.0-20190627213056-c55ef6137fc6
github.com/AudriusButkevicius/recli v0.0.5
github.com/bkaradzic/go-lz4 v0.0.0-20160924222819-7224d8d8f27e
github.com/calmh/du v1.0.1
github.com/calmh/xdr v1.1.0
github.com/ccding/go-stun v0.0.0-20180726100737-be486d185f3d
github.com/certifi/gocertifi v0.0.0-20190506164543-d2eda7129713 // indirect

2
go.sum
View File

@ -13,8 +13,6 @@ github.com/beorn7/perks v1.0.0 h1:HWo1m869IqiPhD389kmkxeTalrjNbbJTC8LXupb+sl0=
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
github.com/bkaradzic/go-lz4 v0.0.0-20160924222819-7224d8d8f27e h1:2augTYh6E+XoNrrivZJBadpThP/dsvYKj0nzqfQ8tM4=
github.com/bkaradzic/go-lz4 v0.0.0-20160924222819-7224d8d8f27e/go.mod h1:0YdlkowM3VswSROI7qDxhRvJ3sLhlFrRRwjwegp5jy4=
github.com/calmh/du v1.0.1 h1:uDCrDbXVVPrzxSNRkpj6nqSfwrl5uRWH3zvrJgl7RRo=
github.com/calmh/du v1.0.1/go.mod h1:pHNccp4cXQeyDaiV3S7t5GN+eGOgynF0VSLxJjk9tLU=
github.com/calmh/xdr v1.1.0 h1:U/Dd4CXNLoo8EiQ4ulJUXkgO1/EyQLgDKLgpY1SOoJE=
github.com/calmh/xdr v1.1.0/go.mod h1:E8sz2ByAdXC8MbANf1LCRYzedSnnc+/sXXJs/PVqoeg=
github.com/ccding/go-stun v0.0.0-20180726100737-be486d185f3d h1:As4937T5NVbJ/DmZT9z33pyLEprMd6CUSfhbmMY57Io=

View File

@ -15,7 +15,7 @@ import (
"strings"
"time"
"github.com/calmh/du"
"github.com/shirou/gopsutil/disk"
)
var (
@ -266,11 +266,14 @@ func (f *BasicFilesystem) Usage(name string) (Usage, error) {
if err != nil {
return Usage{}, err
}
u, err := du.Get(name)
u, err := disk.Usage(name)
if err != nil {
return Usage{}, err
}
return Usage{
Free: u.FreeBytes,
Total: u.TotalBytes,
}, err
Free: int64(u.Free),
Total: int64(u.Total),
}, nil
}
func (f *BasicFilesystem) Type() FilesystemType {