Merge pull request #16998 from mmorel-35/govet/enable-all

chore: enable-all rule from govet
This commit is contained in:
Bartlomiej Plotka 2025-08-06 10:44:44 +01:00 committed by GitHub
commit 3fc87f40e8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 10 additions and 7 deletions

View File

@ -28,6 +28,7 @@ linters:
- fatcontext
- gocritic
- godot
- govet
- loggercheck
- misspell
- nilnesserr
@ -108,6 +109,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) {