Skip to content

Commit

Permalink
Fixup linting issues
Browse files Browse the repository at this point in the history
* Disbale unused-parameter check.
* Fixup minor linting issues.

Signed-off-by: Ben Kochie <superq@gmail.com>
  • Loading branch information
SuperQ committed Jul 17, 2023
1 parent 9a07e41 commit 6f63284
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
6 changes: 6 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 1 addition & 2 deletions collector/ipvs_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions collector/perf_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 1 addition & 3 deletions collector/systemd_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 6f63284

Please sign in to comment.