File tree Expand file tree Collapse file tree 1 file changed +10
-12
lines changed Expand file tree Collapse file tree 1 file changed +10
-12
lines changed Original file line number Diff line number Diff line change @@ -567,23 +567,21 @@ func diskstate() (stateinfo []*status, err error) {
567
567
if err != nil {
568
568
return
569
569
}
570
- stateinfo = make ([]* status , len (parts ))
571
- for i , v := range parts {
570
+ stateinfo = make ([]* status , 0 , len (parts ))
571
+ for _ , v := range parts {
572
572
mp := v .Mountpoint
573
+ if strings .HasPrefix (mp , "/snap/" ) || strings .HasPrefix (mp , "/apex/" ) {
574
+ continue
575
+ }
573
576
diskusage , err := disk .Usage (mp )
574
- usage := ""
575
- precent := 0.0
576
577
if err != nil {
577
- usage = err .Error ()
578
- } else {
579
- usage = storagefmt (float64 (diskusage .Used )) + " / " + storagefmt (float64 (diskusage .Total ))
580
- precent = math .Round (diskusage .UsedPercent )
578
+ continue
581
579
}
582
- stateinfo [ i ] = & status {
583
- precent : precent ,
580
+ stateinfo = append ( stateinfo , & status {
581
+ precent : math . Round ( diskusage . UsedPercent ) ,
584
582
name : mp ,
585
- text : []string {usage },
586
- }
583
+ text : []string {storagefmt ( float64 ( diskusage . Used )) + " / " + storagefmt ( float64 ( diskusage . Total )) },
584
+ })
587
585
}
588
586
return stateinfo , nil
589
587
}
You can’t perform that action at this time.
0 commit comments