From 84eaa8fecd511b5aacb9de5440fdec9c713761bd Mon Sep 17 00:00:00 2001 From: Tobias Schmidt Date: Tue, 28 Feb 2017 17:33:46 -0400 Subject: [PATCH] Remove more unnecessarily named return values --- collector/devstat_dragonfly.go | 2 +- collector/exec_bsd.go | 6 ++---- collector/hwmon_linux.go | 4 ++-- collector/zfs_linux.go | 2 +- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/collector/devstat_dragonfly.go b/collector/devstat_dragonfly.go index 13aa1a55..95639917 100644 --- a/collector/devstat_dragonfly.go +++ b/collector/devstat_dragonfly.go @@ -124,7 +124,7 @@ func NewDevstatCollector() (Collector, error) { }, nil } -func (c *devstatCollector) Update(ch chan<- prometheus.Metric) (err error) { +func (c *devstatCollector) Update(ch chan<- prometheus.Metric) error { count := C._get_ndevs() if count == -1 { return errors.New("getdevs() failed") diff --git a/collector/exec_bsd.go b/collector/exec_bsd.go index 0c794583..07beb518 100644 --- a/collector/exec_bsd.go +++ b/collector/exec_bsd.go @@ -28,7 +28,7 @@ func init() { Factories["exec"] = NewExecCollector } -// NewExecCollector returns a new Collector exposing system execution statistics +// NewExecCollector returns a new Collector exposing system execution statistics. func NewExecCollector() (Collector, error) { // From sys/vm/vm_meter.c: // All are of type CTLTYPE_UINT. @@ -77,15 +77,13 @@ func NewExecCollector() (Collector, error) { } // Update pushes exec statistics onto ch -func (c *execCollector) Update(ch chan<- prometheus.Metric) (err error) { +func (c *execCollector) Update(ch chan<- prometheus.Metric) error { for _, m := range c.sysctls { v, err := m.Value() if err != nil { return err } - // We "know" all of our sysctls are CounterValues, let's skip - // parsing them ch <- prometheus.MustNewConstMetric( prometheus.NewDesc( prometheus.BuildFQName(Namespace, "exec", m.name), diff --git a/collector/hwmon_linux.go b/collector/hwmon_linux.go index c1f4ea4c..da05204e 100644 --- a/collector/hwmon_linux.go +++ b/collector/hwmon_linux.go @@ -101,7 +101,7 @@ func explodeSensorFilename(filename string) (ok bool, sensorType string, sensorN return true, sensorType, sensorNum, sensorProperty } -func collectSensorData(dir string, data map[string]map[string]string) (err error) { +func collectSensorData(dir string, data map[string]map[string]string) error { sensorFiles, dirError := ioutil.ReadDir(dir) if dirError != nil { return dirError @@ -123,7 +123,7 @@ func collectSensorData(dir string, data map[string]map[string]string) (err error return nil } -func (c *hwMonCollector) updateHwmon(ch chan<- prometheus.Metric, dir string) (err error) { +func (c *hwMonCollector) updateHwmon(ch chan<- prometheus.Metric, dir string) error { hwmonName, err := c.hwmonName(dir) if err != nil { return err diff --git a/collector/zfs_linux.go b/collector/zfs_linux.go index f6515bad..6774efa9 100644 --- a/collector/zfs_linux.go +++ b/collector/zfs_linux.go @@ -47,7 +47,7 @@ func (c *zfsCollector) updateZfsStats(subsystem string, ch chan<- prometheus.Met }) } -func (c *zfsCollector) updatePoolStats(ch chan<- prometheus.Metric) (err error) { +func (c *zfsCollector) updatePoolStats(ch chan<- prometheus.Metric) error { zpoolPaths, err := filepath.Glob(procFilePath(filepath.Join(c.linuxProcpathBase, c.linuxZpoolIoPath))) if err != nil { return err