From 7133ab0f7d60196ca848ddf2c1c9f06a5d4062c6 Mon Sep 17 00:00:00 2001 From: Abin Shahab Date: Tue, 21 Oct 2014 05:23:23 +0000 Subject: [PATCH] gofmt all files --- container/raw/container_hints_test.go | 2 +- fs/fs.go | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/container/raw/container_hints_test.go b/container/raw/container_hints_test.go index 50ceb340..6fa03475 100644 --- a/container/raw/container_hints_test.go +++ b/container/raw/container_hints_test.go @@ -27,7 +27,7 @@ func TestGetContainerHintsFromFile(t *testing.T) { if len(cHints.AllHosts[0].Mounts) == 0 { t.Errorf("Cannot find any mounts") } - + for i, mountDir := range cHints.AllHosts[0].Mounts { if correctMountDirs[i] != mountDir.HostDir { t.Errorf("Cannot find mount %s in %s", mountDir.HostDir, cHints) diff --git a/fs/fs.go b/fs/fs.go index d3a439c2..f1330035 100644 --- a/fs/fs.go +++ b/fs/fs.go @@ -12,9 +12,9 @@ import "C" import ( "bufio" "fmt" - "path" "os" "os/exec" + "path" "regexp" "strconv" "strings" @@ -26,6 +26,7 @@ import ( ) var partitionRegex = regexp.MustCompile("sd[a-z]+\\d") + type partition struct { mountpoint string major uint @@ -98,7 +99,6 @@ func getDiskStatsMap(diskStatsFile string) (map[string]DiskStats, error) { defer file.Close() scanner := bufio.NewScanner(file) - for scanner.Scan() { line := scanner.Text() words := strings.Fields(line) @@ -109,13 +109,13 @@ func getDiskStatsMap(diskStatsFile string) (map[string]DiskStats, error) { deviceName := path.Join("/dev", words[2]) wordLength := len(words) offset := 3 - var stats = make([]uint64, wordLength - offset) + var stats = make([]uint64, wordLength-offset) if len(stats) < 11 { return nil, fmt.Errorf("could not parse all 11 columns of /proc/diskstats") } var error error for i := offset; i < wordLength; i++ { - stats[i - offset], error = strconv.ParseUint(words[i], 10, 64) + stats[i-offset], error = strconv.ParseUint(words[i], 10, 64) if error != nil { return nil, error }