diff --git a/.golangci.yml b/.golangci.yml index bc18dcc3fc..3f7e4589cb 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -25,3 +25,9 @@ linters-settings: - (net/http.ResponseWriter).Write # Never check for logger errors. - (github.com/go-kit/log.Logger).Log + revive: + rules: + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unused-parameter + - name: unused-parameter + severity: warning + disabled: true diff --git a/collector/ipvs_linux_test.go b/collector/ipvs_linux_test.go index 0632296b39..8c43ad8b8c 100644 --- a/collector/ipvs_linux_test.go +++ b/collector/ipvs_linux_test.go @@ -209,9 +209,8 @@ func TestIPVSCollectorResponse(t *testing.T) { if want == got { // this is a line we are interested in, and it is correct continue wantLoop - } else { - gotLinesIdx++ } + gotLinesIdx++ } // if this point is reached, the line we want was missing t.Fatalf("Missing expected output line(s), first missing line is %s", want) diff --git a/collector/perf_linux_test.go b/collector/perf_linux_test.go index bd2a591b93..c4990d7711 100644 --- a/collector/perf_linux_test.go +++ b/collector/perf_linux_test.go @@ -54,7 +54,9 @@ func TestPerfCollector(t *testing.T) { metrics := make(chan prometheus.Metric) defer close(metrics) go func() { + i := 0 for range metrics { + i++ } }() if err := collector.Update(metrics); err != nil { diff --git a/collector/systemd_linux.go b/collector/systemd_linux.go index 31eb84d534..9fb6afdb48 100644 --- a/collector/systemd_linux.go +++ b/collector/systemd_linux.go @@ -334,9 +334,7 @@ func (c *systemdCollector) collectSockets(conn *dbus.Conn, ch chan<- prometheus. // NRefused wasn't added until systemd 239. refusedConnectionCount, err := conn.GetUnitTypePropertyContext(context.TODO(), unit.Name, "Socket", "NRefused") - if err != nil { - //log.Debugf("couldn't get unit '%s' NRefused: %s", unit.Name, err) - } else { + if err == nil { ch <- prometheus.MustNewConstMetric( c.socketRefusedConnectionsDesc, prometheus.GaugeValue, float64(refusedConnectionCount.Value.Value().(uint32)), unit.Name)