gofmt all files

This commit is contained in:
Abin Shahab 2014-10-21 05:23:23 +00:00
parent 48129c03d1
commit 7133ab0f7d
2 changed files with 5 additions and 5 deletions

View File

@ -12,9 +12,9 @@ import "C"
import ( import (
"bufio" "bufio"
"fmt" "fmt"
"path"
"os" "os"
"os/exec" "os/exec"
"path"
"regexp" "regexp"
"strconv" "strconv"
"strings" "strings"
@ -26,6 +26,7 @@ import (
) )
var partitionRegex = regexp.MustCompile("sd[a-z]+\\d") var partitionRegex = regexp.MustCompile("sd[a-z]+\\d")
type partition struct { type partition struct {
mountpoint string mountpoint string
major uint major uint
@ -98,7 +99,6 @@ func getDiskStatsMap(diskStatsFile string) (map[string]DiskStats, error) {
defer file.Close() defer file.Close()
scanner := bufio.NewScanner(file) scanner := bufio.NewScanner(file)
for scanner.Scan() { for scanner.Scan() {
line := scanner.Text() line := scanner.Text()
words := strings.Fields(line) words := strings.Fields(line)
@ -109,13 +109,13 @@ func getDiskStatsMap(diskStatsFile string) (map[string]DiskStats, error) {
deviceName := path.Join("/dev", words[2]) deviceName := path.Join("/dev", words[2])
wordLength := len(words) wordLength := len(words)
offset := 3 offset := 3
var stats = make([]uint64, wordLength - offset) var stats = make([]uint64, wordLength-offset)
if len(stats) < 11 { if len(stats) < 11 {
return nil, fmt.Errorf("could not parse all 11 columns of /proc/diskstats") return nil, fmt.Errorf("could not parse all 11 columns of /proc/diskstats")
} }
var error error var error error
for i := offset; i < wordLength; i++ { 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 { if error != nil {
return nil, error return nil, error
} }