diff --git a/collector/bonding.go b/collector/bonding.go index 7b309eef..05cc9afc 100644 --- a/collector/bonding.go +++ b/collector/bonding.go @@ -1,4 +1,4 @@ -// +build linux,!nobonding +// +build !nobonding package collector diff --git a/collector/diskstats.go b/collector/diskstats.go index c34ef7bf..57c703bc 100644 --- a/collector/diskstats.go +++ b/collector/diskstats.go @@ -1,4 +1,4 @@ -// +build linux,!nodiskstats +// +build !nodiskstats package collector diff --git a/collector/filesystem.go b/collector/filesystem.go index f0473868..dc7724f6 100644 --- a/collector/filesystem.go +++ b/collector/filesystem.go @@ -1,4 +1,4 @@ -// +build linux,!nofilesystem +// +build !nofilesystem package collector diff --git a/collector/interrupts.go b/collector/interrupts.go index b0c93b8d..aebe184b 100644 --- a/collector/interrupts.go +++ b/collector/interrupts.go @@ -1,4 +1,4 @@ -// +build linux,!nointerrupts +// +build !nointerrupts package collector diff --git a/collector/lastlogin.go b/collector/lastlogin.go index bbfbc6ee..1a0c39dd 100644 --- a/collector/lastlogin.go +++ b/collector/lastlogin.go @@ -1,4 +1,4 @@ -// +build linux,!nolastlogin +// +build !nolastlogin package collector diff --git a/collector/megacli.go b/collector/megacli.go index 77ec64a6..f66da864 100644 --- a/collector/megacli.go +++ b/collector/megacli.go @@ -1,4 +1,4 @@ -// +build linux,!nomegacli +// +build !nomegacli package collector diff --git a/collector/meminfo_linux.go b/collector/meminfo_linux.go index 6656ff4b..5ed920b1 100644 --- a/collector/meminfo_linux.go +++ b/collector/meminfo_linux.go @@ -1,4 +1,4 @@ -// +build linux,!nomeminfo +// +build !nomeminfo package collector diff --git a/collector/netdev.go b/collector/netdev.go index 003a17e1..ee1de005 100644 --- a/collector/netdev.go +++ b/collector/netdev.go @@ -1,4 +1,4 @@ -// +build linux,!nonetdev +// +build !nonetdev package collector diff --git a/collector/netstat.go b/collector/netstat.go index 46278776..67b9fba1 100644 --- a/collector/netstat.go +++ b/collector/netstat.go @@ -1,4 +1,4 @@ -// +build linux,!nonetstat +// +build !nonetstat package collector diff --git a/collector/stat.go b/collector/stat.go index 939af5d1..4f7241e5 100644 --- a/collector/stat.go +++ b/collector/stat.go @@ -1,4 +1,4 @@ -// +build linux,!nostat +// +build !nostat package collector @@ -98,11 +98,11 @@ func (c *statCollector) Update(ch chan<- prometheus.Metric) (err error) { // Only some of these may be present, depending on kernel version. cpuFields := []string{"user", "nice", "system", "idle", "iowait", "irq", "softirq", "steal", "guest"} // OpenVZ guests lack the "guest" CPU field, which needs to be ignored. - expectedFieldNum := len(cpuFields) + 1 + expectedFieldNum := len(cpuFields)+1 if expectedFieldNum > len(parts) { expectedFieldNum = len(parts) } - for i, v := range parts[1:expectedFieldNum] { + for i, v := range parts[1 : expectedFieldNum] { value, err := strconv.ParseFloat(v, 64) if err != nil { return err diff --git a/collector/tcpstat.go b/collector/tcpstat.go index b787b0ce..2753b45c 100644 --- a/collector/tcpstat.go +++ b/collector/tcpstat.go @@ -1,4 +1,4 @@ -// +build linux,!notcpstat +// +build !notcpstat package collector