From 7e2b65f9428e81744941830fab276f12a4e0a5ce Mon Sep 17 00:00:00 2001 From: Tobias Schmidt Date: Fri, 16 Oct 2015 15:17:44 -0400 Subject: [PATCH] Clean up lint errors --- collector/supervisord.go | 1 + node_exporter.go | 16 ++++++++-------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/collector/supervisord.go b/collector/supervisord.go index 795bb4db..55b5154e 100644 --- a/collector/supervisord.go +++ b/collector/supervisord.go @@ -12,6 +12,7 @@ // limitations under the License. // +build !nosupervisord + package collector import ( diff --git a/node_exporter.go b/node_exporter.go index 0765642c..4704f94e 100644 --- a/node_exporter.go +++ b/node_exporter.go @@ -35,7 +35,7 @@ import ( const subsystem = "exporter" var ( - // set at build time + // Version of node_exporter. Set at build time. Version = "0.0.0.dev" memProfile = flag.String("debug.memprofile-file", "", "Write memory profile to this file upon receipt of SIGUSR1.") @@ -59,23 +59,23 @@ var ( ) ) -// Implements Collector. +// NodeCollector implements the prometheus.Collector interface. type NodeCollector struct { collectors map[string]collector.Collector } -// Implements Collector. +// Describe implements the prometheus.Collector interface. func (n NodeCollector) Describe(ch chan<- *prometheus.Desc) { scrapeDurations.Describe(ch) } -// Implements Collector. +// Collect implements the prometheus.Collector interface. func (n NodeCollector) Collect(ch chan<- prometheus.Metric) { wg := sync.WaitGroup{} wg.Add(len(n.collectors)) for name, c := range n.collectors { go func(name string, c collector.Collector) { - Execute(name, c, ch) + execute(name, c, ch) wg.Done() }(name, c) } @@ -100,7 +100,7 @@ func (h *basicAuthHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { return } -func Execute(name string, c collector.Collector, ch chan<- prometheus.Metric) { +func execute(name string, c collector.Collector, ch chan<- prometheus.Metric) { begin := time.Now() err := c.Update(ch) duration := time.Since(begin) @@ -137,7 +137,7 @@ func main() { if *printCollectors { collectorNames := make(sort.StringSlice, 0, len(collector.Factories)) - for n, _ := range collector.Factories { + for n := range collector.Factories { collectorNames = append(collectorNames, n) } collectorNames.Sort() @@ -153,7 +153,7 @@ func main() { } log.Infof("Enabled collectors:") - for n, _ := range collectors { + for n := range collectors { log.Infof(" - %s", n) }