Improve linting (#861)

* Disable unused-parameter check due to false positives on Collect()
  calls.
* Enable misspell.
* Simplify error returns.

Signed-off-by: SuperQ <superq@gmail.com>
This commit is contained in:
Ben Kochie 2023-07-06 13:08:45 +02:00 committed by GitHub
parent 6b56e2f057
commit 5f917ccdd9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 12 deletions

View File

@ -1,6 +1,7 @@
---
linters:
enable:
- misspell
- revive
issues:
@ -14,3 +15,9 @@ linters-settings:
exclude-functions:
# 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

View File

@ -115,10 +115,7 @@ func (c PGDatabaseCollector) Update(ctx context.Context, instance *instance, ch
prometheus.GaugeValue, sizeMetric, datname,
)
}
if err := rows.Err(); err != nil {
return err
}
return nil
return rows.Err()
}
func sliceContains(slice []string, s string) bool {

View File

@ -126,8 +126,5 @@ func (PGReplicationSlotCollector) Update(ctx context.Context, instance *instance
prometheus.GaugeValue, isActiveValue, slotNameLabel,
)
}
if err := rows.Err(); err != nil {
return err
}
return nil
return rows.Err()
}

View File

@ -218,8 +218,5 @@ func (PGStatIOUserTablesCollector) Update(ctx context.Context, instance *instanc
datnameLabel, schemanameLabel, relnameLabel,
)
}
if err := rows.Err(); err != nil {
return err
}
return nil
return rows.Err()
}