chore: enable-all rule from govet

Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
This commit is contained in:
Matthieu MOREL 2025-08-04 17:58:23 +02:00
parent 789fddf25a
commit 0484a6d547
4 changed files with 10 additions and 7 deletions

View File

@ -27,6 +27,7 @@ linters:
- exptostd
- gocritic
- godot
- govet
- loggercheck
- misspell
- nilnesserr
@ -107,6 +108,11 @@ linters:
- (*net/http.Server).Shutdown
# Never check for rollback errors as Rollback() is called when a previous error was detected.
- (github.com/prometheus/prometheus/storage.Appender).Rollback
govet:
disable:
- shadow
- fieldalignment
enable-all: true
perfsprint:
# Optimizes even if it requires an int or uint type cast.
int-conversion: true

View File

@ -221,10 +221,8 @@ func (d *discovery) Run(ctx context.Context, ch chan<- []*targetgroup.Group) {
}
}
d.oldSourceList = newSourceList
if err == nil {
// We're returning all Consul services as a single targetgroup.
ch <- tgs
}
// We're returning all Consul services as a single targetgroup.
ch <- tgs
// Wait for ticker or exit when ctx is closed.
select {
case <-c:

View File

@ -39,10 +39,9 @@ func TestRecoverEvaluatorRuntime(t *testing.T) {
require.Contains(t, output.String(), "sum(up)")
}()
defer ev.recover(expr, nil, &err)
// Cause a runtime panic.
var a []int
a[123] = 1
a[123] = 1 //nolint:govet // This is intended to cause a runtime panic.
}
func TestRecoverEvaluatorError(t *testing.T) {

View File

@ -5526,7 +5526,7 @@ func TestRecoverParserRuntime(t *testing.T) {
defer p.recover(&err)
// Cause a runtime panic.
var a []int
a[123] = 1
a[123] = 1 //nolint:govet // This is intended to cause a runtime panic.
}
func TestRecoverParserError(t *testing.T) {