feat: disable copyloopvar and intrange on Go < 1.22 (#4397)

This commit is contained in:
Ludovic Fernandez 2024-02-19 14:58:58 +01:00 committed by GitHub
parent c65868c105
commit 64492b5e59
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 148 additions and 32 deletions

View file

@ -3,8 +3,6 @@ package linter
import (
"context"
"golang.org/x/tools/go/analysis"
"github.com/golangci/golangci-lint/pkg/result"
)
@ -15,14 +13,23 @@ type Linter interface {
}
type Noop struct {
name string
desc string
run func(pass *analysis.Pass) (any, error)
name string
desc string
reason string
}
func NewNoop(l Linter, reason string) Noop {
return Noop{
name: l.Name(),
desc: l.Desc(),
reason: reason,
}
}
func (n Noop) Run(_ context.Context, lintCtx *Context) ([]result.Issue, error) {
lintCtx.Log.Warnf("%s is disabled because of generics."+
" You can track the evolution of the generics support by following the https://github.com/golangci/golangci-lint/issues/2649.", n.name)
if n.reason != "" {
lintCtx.Log.Warnf("%s: %s", n.name, n.reason)
}
return nil, nil
}