diff --git a/go.mod b/go.mod index b1b717f30dd9..75f4d2da6297 100644 --- a/go.mod +++ b/go.mod @@ -69,7 +69,6 @@ require ( github.com/ldez/gomoddirectives v0.2.4 github.com/ldez/tagliatelle v0.5.0 github.com/leonklingele/grouper v1.1.2 - github.com/lufeee/execinquery v1.2.1 github.com/macabu/inamedparam v0.1.3 github.com/maratori/testableexamples v1.0.0 github.com/maratori/testpackage v1.1.1 diff --git a/go.sum b/go.sum index e473209e2968..05551a6ac243 100644 --- a/go.sum +++ b/go.sum @@ -347,8 +347,6 @@ github.com/ldez/tagliatelle v0.5.0 h1:epgfuYt9v0CG3fms0pEgIMNPuFf/LpPIfjk4kyqSio github.com/ldez/tagliatelle v0.5.0/go.mod h1:rj1HmWiL1MiKQuOONhd09iySTEkUuE/8+5jtPYz9xa4= github.com/leonklingele/grouper v1.1.2 h1:o1ARBDLOmmasUaNDesWqWCIFH3u7hoFlM84YrjT3mIY= github.com/leonklingele/grouper v1.1.2/go.mod h1:6D0M/HVkhs2yRKRFZUoGjeDy7EZTfFBE9gl4kjmIGkA= -github.com/lufeee/execinquery v1.2.1 h1:hf0Ems4SHcUGBxpGN7Jz78z1ppVkP/837ZlETPCEtOM= -github.com/lufeee/execinquery v1.2.1/go.mod h1:EC7DrEKView09ocscGHC+apXMIaorh4xqSxS/dy8SbM= github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 h1:6E+4a0GO5zZEnZ81pIr0yLvtUWk2if982qA3F3QD6H4= github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I= github.com/macabu/inamedparam v0.1.3 h1:2tk/phHkMlEL/1GNe/Yf6kkR/hkcUdAEY3L0hjYV1Mk= diff --git a/jsonschema/golangci.next.jsonschema.json b/jsonschema/golangci.next.jsonschema.json index 7a012ec288df..d5ca2ded716a 100644 --- a/jsonschema/golangci.next.jsonschema.json +++ b/jsonschema/golangci.next.jsonschema.json @@ -317,7 +317,6 @@ "contextcheck", "copyloopvar", "cyclop", - "deadcode", "decorder", "depguard", "dogsled", @@ -328,9 +327,7 @@ "errchkjson", "errname", "errorlint", - "execinquery", "exhaustive", - "exhaustivestruct", "exhaustruct", "exportloopref", "fatcontext", @@ -354,7 +351,6 @@ "gofumpt", "goheader", "goimports", - "golint", "gomoddirectives", "gomodguard", "goprintffuncname", @@ -364,19 +360,16 @@ "govet", "grouper", "iface", - "ifshort", "importas", "inamedparam", "ineffassign", "interfacebloat", - "interfacer", "intrange", "ireturn", "lll", "loggercheck", "maintidx", "makezero", - "maligned", "mirror", "misspell", "mnd", @@ -389,7 +382,6 @@ "noctx", "nolintlint", "nonamedreturns", - "nosnakecase", "nosprintfhostport", "paralleltest", "perfsprint", @@ -401,11 +393,9 @@ "recvcheck", "revive", "rowserrcheck", - "scopelint", "sloglint", "sqlclosecheck", "staticcheck", - "structcheck", "stylecheck", "tagalign", "tagliatelle", @@ -419,7 +409,6 @@ "unparam", "unused", "usestdlibvars", - "varcheck", "varnamelen", "wastedassign", "whitespace", diff --git a/pkg/config/linters_settings.go b/pkg/config/linters_settings.go index 3760d6a40de8..3c2364ad7623 100644 --- a/pkg/config/linters_settings.go +++ b/pkg/config/linters_settings.go @@ -229,7 +229,6 @@ type LintersSettings struct { Gofumpt GofumptSettings Goheader GoHeaderSettings Goimports GoImportsSettings - Gomnd GoMndSettings GoModDirectives GoModDirectivesSettings Gomodguard GoModGuardSettings Gosec GoSecSettings @@ -569,14 +568,6 @@ type GoImportsSettings struct { LocalPrefixes string `mapstructure:"local-prefixes"` } -// Deprecated: use MndSettings. -type GoMndSettings struct { - MndSettings `mapstructure:",squash"` - - // Deprecated: use root level settings instead. - Settings map[string]map[string]any -} - type GoModDirectivesSettings struct { ReplaceAllowList []string `mapstructure:"replace-allow-list"` ReplaceLocal bool `mapstructure:"replace-local"` diff --git a/pkg/config/loader.go b/pkg/config/loader.go index efdbfce1f17d..63a2daa3c0e3 100644 --- a/pkg/config/loader.go +++ b/pkg/config/loader.go @@ -413,12 +413,6 @@ func (l *Loader) handleLinterOptionDeprecations() { l.log.Warnf("The configuration option `linters.godot.check-all` is deprecated, please use `linters.godot.scope: all`.") } - // Deprecated since v1.44.0. - if len(l.cfg.LintersSettings.Gomnd.Settings) > 0 { - l.log.Warnf("The configuration option `linters.gomnd.settings` is deprecated. Please use the options " + - "`linters.gomnd.checks`,`linters.gomnd.ignored-numbers`,`linters.gomnd.ignored-files`,`linters.gomnd.ignored-functions`.") - } - // Deprecated since v1.47.0 if l.cfg.LintersSettings.Gofumpt.LangVersion != "" { l.log.Warnf("The configuration option `linters.gofumpt.lang-version` is deprecated, please use global `run.go`.") diff --git a/pkg/golinters/execinquery/execinquery.go b/pkg/golinters/execinquery/execinquery.go deleted file mode 100644 index 3832873c6367..000000000000 --- a/pkg/golinters/execinquery/execinquery.go +++ /dev/null @@ -1,19 +0,0 @@ -package execinquery - -import ( - "github.com/lufeee/execinquery" - "golang.org/x/tools/go/analysis" - - "github.com/golangci/golangci-lint/pkg/goanalysis" -) - -func New() *goanalysis.Linter { - a := execinquery.Analyzer - - return goanalysis.NewLinter( - a.Name, - a.Doc, - []*analysis.Analyzer{a}, - nil, - ).WithLoadMode(goanalysis.LoadModeTypesInfo) -} diff --git a/pkg/golinters/execinquery/execinquery_integration_test.go b/pkg/golinters/execinquery/execinquery_integration_test.go deleted file mode 100644 index 4ee2ca919656..000000000000 --- a/pkg/golinters/execinquery/execinquery_integration_test.go +++ /dev/null @@ -1,11 +0,0 @@ -package execinquery - -import ( - "testing" - - "github.com/golangci/golangci-lint/test/testshared/integration" -) - -func TestFromTestdata(t *testing.T) { - integration.RunTestdata(t) -} diff --git a/pkg/golinters/execinquery/testdata/execinquery.go b/pkg/golinters/execinquery/testdata/execinquery.go deleted file mode 100644 index 36db0af8d3e8..000000000000 --- a/pkg/golinters/execinquery/testdata/execinquery.go +++ /dev/null @@ -1,30 +0,0 @@ -//golangcitest:args -Eexecinquery -package testdata - -import ( - "context" - "database/sql" -) - -func execInQuery(db *sql.DB) { - test := "a" - - _, err := db.Query("Update * FROM hoge where id = ?", test) // want "Use Exec instead of Query to execute `UPDATE` query" - if err != nil { - return - } - - db.QueryRow("Update * FROM hoge where id = ?", test) // want "Use Exec instead of QueryRow to execute `UPDATE` query" - if err != nil { - return - } - - ctx := context.Background() - - _, err = db.QueryContext(ctx, "Update * FROM hoge where id = ?", test) // want "Use ExecContext instead of QueryContext to execute `UPDATE` query" - if err != nil { - return - } - - db.QueryRowContext(ctx, "Update * FROM hoge where id = ?", test) // want "Use ExecContext instead of QueryRowContext to execute `UPDATE` query" -} diff --git a/pkg/golinters/mnd/mnd.go b/pkg/golinters/mnd/mnd.go index 9aa8692ff3d7..fe64653b91b0 100644 --- a/pkg/golinters/mnd/mnd.go +++ b/pkg/golinters/mnd/mnd.go @@ -12,27 +12,6 @@ func New(settings *config.MndSettings) *goanalysis.Linter { return newMND(mnd.Analyzer, settings, nil) } -func NewGoMND(settings *config.GoMndSettings) *goanalysis.Linter { - // shallow copy because mnd.Analyzer is a global variable. - a := new(analysis.Analyzer) - *a = *mnd.Analyzer - - // Used to force the analyzer name to use the same name as the linter. - // This is required to avoid displaying the analyzer name inside the issue text. - a.Name = "gomnd" - - var linterCfg map[string]map[string]any - - if settings != nil && len(settings.Settings) > 0 { - // Convert deprecated setting. - linterCfg = map[string]map[string]any{ - a.Name: settings.Settings["mnd"], - } - } - - return newMND(a, &settings.MndSettings, linterCfg) -} - func newMND(a *analysis.Analyzer, settings *config.MndSettings, linterCfg map[string]map[string]any) *goanalysis.Linter { if len(linterCfg) == 0 && settings != nil { cfg := make(map[string]any) diff --git a/pkg/lint/lintersdb/builder_linter.go b/pkg/lint/lintersdb/builder_linter.go index 00178075e5b4..d2a2dc3d0744 100644 --- a/pkg/lint/lintersdb/builder_linter.go +++ b/pkg/lint/lintersdb/builder_linter.go @@ -23,7 +23,6 @@ import ( "github.com/golangci/golangci-lint/pkg/golinters/errchkjson" "github.com/golangci/golangci-lint/pkg/golinters/errname" "github.com/golangci/golangci-lint/pkg/golinters/errorlint" - "github.com/golangci/golangci-lint/pkg/golinters/execinquery" "github.com/golangci/golangci-lint/pkg/golinters/exhaustive" "github.com/golangci/golangci-lint/pkg/golinters/exhaustruct" "github.com/golangci/golangci-lint/pkg/golinters/exportloopref" @@ -250,12 +249,12 @@ func (LinterBuilder) Build(cfg *config.Config) ([]*linter.Config, error) { WithLoadForGoAnalysis(). WithURL("https://github.com/polyfloyd/go-errorlint"), - linter.NewConfig(execinquery.New()). + linter.NewConfig(linter.NewNoopDeprecated("execinquery", cfg, linter.DeprecationError)). WithSince("v1.46.0"). WithPresets(linter.PresetSQL). WithLoadForGoAnalysis(). WithURL("https://github.com/1uf3/execinquery"). - DeprecatedWarning("The repository of the linter has been archived by the owner.", "v1.58.0", ""), + DeprecatedError("The repository of the linter has been archived by the owner.", "v1.58.0", ""), linter.NewConfig(exhaustive.New(&cfg.LintersSettings.Exhaustive)). WithSince(" v1.28.0"). @@ -418,11 +417,11 @@ func (LinterBuilder) Build(cfg *config.Config) ([]*linter.Config, error) { WithPresets(linter.PresetStyle). WithURL("https://github.com/tommy-muehle/go-mnd"), - linter.NewConfig(mnd.NewGoMND(&cfg.LintersSettings.Gomnd)). + linter.NewConfig(linter.NewNoopDeprecated("gomnd", cfg, linter.DeprecationError)). WithSince("v1.22.0"). WithPresets(linter.PresetStyle). WithURL("https://github.com/tommy-muehle/go-mnd"). - DeprecatedWarning("The linter has been renamed.", "v1.58.0", "mnd"), + DeprecatedError("The linter has been renamed.", "v1.58.0", "mnd"), linter.NewConfig(gomoddirectives.New(&cfg.LintersSettings.GoModDirectives)). WithSince("v1.39.0").