From 4bc631921fd78cca0a18c46042be2cb3e04b4145 Mon Sep 17 00:00:00 2001 From: WAKAYAMA shirou Date: Fri, 17 Jul 2015 21:52:43 +0900 Subject: [PATCH] cpu: fix command output trim problem. --- cpu/cpu_darwin.go | 2 +- cpu/cpu_freebsd.go | 2 +- cpu/cpu_linux.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cpu/cpu_darwin.go b/cpu/cpu_darwin.go index ff27a74..4f7dbde 100644 --- a/cpu/cpu_darwin.go +++ b/cpu/cpu_darwin.go @@ -27,7 +27,7 @@ func init() { out, err := exec.Command("/usr/bin/getconf", "CLK_TCK").Output() // ignore errors if err == nil { - i, err := strconv.ParseFloat(string(out), 64) + i, err := strconv.ParseFloat(strings.TrimSpace(string(out)), 64) if err == nil { ClocksPerSec = float64(i) } diff --git a/cpu/cpu_freebsd.go b/cpu/cpu_freebsd.go index c1e542e..2c22a39 100644 --- a/cpu/cpu_freebsd.go +++ b/cpu/cpu_freebsd.go @@ -28,7 +28,7 @@ func init() { out, err := exec.Command("/usr/bin/getconf", "CLK_TCK").Output() // ignore errors if err == nil { - i, err := strconv.ParseFloat(string(out), 64) + i, err := strconv.ParseFloat(strings.TrimSpace(string(out)), 64) if err == nil { ClocksPerSec = float64(i) } diff --git a/cpu/cpu_linux.go b/cpu/cpu_linux.go index 5499389..74054dd 100644 --- a/cpu/cpu_linux.go +++ b/cpu/cpu_linux.go @@ -17,7 +17,7 @@ func init() { out, err := exec.Command("/usr/bin/getconf", "CLK_TCK").Output() // ignore errors if err == nil { - i, err := strconv.ParseFloat(string(out), 64) + i, err := strconv.ParseFloat(strings.TrimSpace(string(out)), 64) if err == nil { cpu_tick = float64(i) }