From 06a21ae66ae6f1d676537a82e9af6c4ef8f6bd19 Mon Sep 17 00:00:00 2001 From: JHE Date: Thu, 7 Feb 2019 00:01:51 +0800 Subject: [PATCH] Fix some issue. --- disk/disk_linux.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/disk/disk_linux.go b/disk/disk_linux.go index c272c2c..0069af0 100644 --- a/disk/disk_linux.go +++ b/disk/disk_linux.go @@ -224,16 +224,16 @@ func Partitions(all bool) ([]PartitionStat, error) { } func PartitionsWithContext(ctx context.Context, all bool) ([]PartitionStat, error) { - UseMounts := false + useMounts := false filename := common.HostProc("self/mountinfo") lines, err := common.ReadLines(filename) if err != nil { - UseMounts = true + useMounts = true } //if kernel not support self/mountinfo - if UseMounts == true { + if useMounts { filename := common.HostProc("self/mounts") lines, err = common.ReadLines(filename) if err != nil { @@ -256,7 +256,7 @@ func PartitionsWithContext(ctx context.Context, all bool) ([]PartitionStat, erro // (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) (11) // split the mountinfo line by the separator hyphen - if UseMounts == true { + if useMounts { fields := strings.Fields(line) d = PartitionStat{ @@ -266,7 +266,7 @@ func PartitionsWithContext(ctx context.Context, all bool) ([]PartitionStat, erro Opts: fields[3], } - if all == false { + if !all { if d.Device == "none" || !common.StringsHas(fs, d.Fstype) { continue } @@ -293,7 +293,7 @@ func PartitionsWithContext(ctx context.Context, all bool) ([]PartitionStat, erro Opts: mountOpts, } - if all == false { + if !all { if d.Device == "none" || !common.StringsHas(fs, d.Fstype) { continue }