mirror of
https://github.com/scratchfoundation/golangci-lint.git
synced 2025-08-28 22:28:43 -04:00
feat: disable copyloopvar and intrange on Go < 1.22 (#4397)
This commit is contained in:
parent
c65868c105
commit
64492b5e59
12 changed files with 148 additions and 32 deletions
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue