Restructure golangci-lint config: explicit opt-in (#15744)

* update golangci-lint configuration to enable basic linters only

* Add back formatter

* feedback

* Add nolint
This commit is contained in:
terence
2025-09-25 10:01:22 -07:00
committed by GitHub
parent fe9dd255c7
commit 924fe4de98
4 changed files with 14 additions and 69 deletions

View File

@@ -56,7 +56,6 @@ jobs:
uses: golangci/golangci-lint-action@v8
with:
version: v2.4
only-new-issues: true
build:
name: Build

View File

@@ -2,72 +2,13 @@ version: "2"
run:
go: 1.23.5
linters:
default: all
disable:
- asasalint
- bodyclose
- containedctx
- contextcheck
- cyclop
- depguard
- dogsled
- dupl
- durationcheck
- err113
- errname
- exhaustive
- exhaustruct
- forbidigo
- forcetypeassert
- funlen
- gochecknoglobals
- gochecknoinits
- goconst
- gocritic
- gocyclo
- godot
- godox
- gomoddirectives
- gosec
enable:
- errcheck
- ineffassign
- govet
- inamedparam
- interfacebloat
- intrange
- ireturn
- lll
- maintidx
- makezero
- mnd
- musttag
- nakedret
- nestif
- nilnil
- nlreturn
- noctx
- noinlineerr
- nolintlint
- nonamedreturns
- nosprintfhostport
- perfsprint
- prealloc
- predeclared
- promlinter
- protogetter
- recvcheck
- revive
- spancheck
disable:
- staticcheck
- tagalign
- tagliatelle
- thelper
- unparam
- usetesting
- varnamelen
- wrapcheck
- wsl
settings:
gocognit:
min-complexity: 65
- unused
exclusions:
generated: lax
presets:
@@ -83,6 +24,7 @@ linters:
- third_party$
- builtin$
- examples$
formatters:
enable:
- gofmt
@@ -96,4 +38,4 @@ formatters:
- tools/analyzers
- third_party$
- builtin$
- examples$
- examples$

View File

@@ -0,0 +1,3 @@
### Ignored
- Update golangci-lint config to enable only basic linters that currently pass

View File

@@ -90,6 +90,7 @@ func (r *runner) run(ctx context.Context) {
select {
case <-ctx.Done():
log.Info("Context canceled, stopping validator")
//nolint:govet
return // Exit if context is canceled.
case slot := <-v.NextSlot():
if !r.healthMonitor.IsHealthy() {
@@ -98,7 +99,7 @@ func (r *runner) run(ctx context.Context) {
}
deadline := v.SlotDeadline(slot)
slotCtx, cancel := context.WithDeadline(ctx, deadline)
slotCtx, cancel := context.WithDeadline(ctx, deadline) //nolint:govet
var span trace.Span
slotCtx, span = prysmTrace.StartSpan(slotCtx, "validator.processSlot")
@@ -131,7 +132,7 @@ func (r *runner) run(ctx context.Context) {
// Start fetching domain data for the next epoch.
if slots.IsEpochEnd(slot) {
domainCtx, _ := context.WithDeadline(ctx, deadline)
domainCtx, _ := context.WithDeadline(ctx, deadline) //nolint:govet
go v.UpdateDomainDataCaches(domainCtx, slot+1)
}
@@ -145,7 +146,7 @@ func (r *runner) run(ctx context.Context) {
continue
}
// performRoles calls span.End()
rolesCtx, _ := context.WithDeadline(ctx, deadline)
rolesCtx, _ := context.WithDeadline(ctx, deadline) //nolint:govet
performRoles(rolesCtx, allRoles, v, slot, &wg, span)
case e := <-v.EventsChan():
v.ProcessEvent(ctx, e)