summaryrefslogtreecommitdiffstats
path: root/widgets/disk.go
diff options
context:
space:
mode:
authorCaleb Bassi <calebjbassi@gmail.com>2018-03-03 17:05:52 -0800
committerCaleb Bassi <calebjbassi@gmail.com>2018-03-03 17:05:52 -0800
commit47a98de44b1bf6bb4cbeec5de701f722f6fdf0bd (patch)
tree56d86ffcd60d05707da692e4e87a6a773f92dbf6 /widgets/disk.go
parente79f0e0a83ef78a40c690dbf3455051c43d4705f (diff)
Code cleanup
Diffstat (limited to 'widgets/disk.go')
-rw-r--r--widgets/disk.go15
1 files changed, 9 insertions, 6 deletions
diff --git a/widgets/disk.go b/widgets/disk.go
index 000c936..cab0135 100644
--- a/widgets/disk.go
+++ b/widgets/disk.go
@@ -6,7 +6,7 @@ import (
ui "github.com/cjbassi/gotop/termui"
"github.com/cjbassi/gotop/utils"
- disk "github.com/shirou/gopsutil/disk"
+ psDisk "github.com/shirou/gopsutil/disk"
)
type Disk struct {
@@ -16,8 +16,11 @@ type Disk struct {
}
func NewDisk() *Disk {
- // get root filesystem usage
- d := &Disk{ui.NewGauge(), "/", time.Second * 5}
+ d := &Disk{
+ Gauge: ui.NewGauge(),
+ fs: "/",
+ interval: time.Second * 5,
+ }
d.Label = "Disk Usage"
go d.update()
@@ -32,7 +35,7 @@ func NewDisk() *Disk {
}
func (d *Disk) update() {
- disk, _ := disk.Usage(d.fs)
- d.Percent = int(disk.UsedPercent)
- d.Description = fmt.Sprintf(" (%dGB free)", int(utils.BytesToGB(disk.Free)))
+ usage, _ := psDisk.Usage(d.fs)
+ d.Percent = int(usage.UsedPercent)
+ d.Description = fmt.Sprintf(" (%dGB free)", int(utils.BytesToGB(usage.Free)))
}