Skip to content

Commit 874a8ba

Browse files
authored
feat: deprecation step 2 of execinquery and gomnd (#5110)
1 parent 6ba5f63 commit 874a8ba

File tree

10 files changed

+4
-115
lines changed

10 files changed

+4
-115
lines changed

Diff for: go.mod

-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ require (
6969
github.com/ldez/gomoddirectives v0.2.4
7070
github.com/ldez/tagliatelle v0.5.0
7171
github.com/leonklingele/grouper v1.1.2
72-
github.com/lufeee/execinquery v1.2.1
7372
github.com/macabu/inamedparam v0.1.3
7473
github.com/maratori/testableexamples v1.0.0
7574
github.com/maratori/testpackage v1.1.1

Diff for: go.sum

-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: jsonschema/golangci.next.jsonschema.json

-11
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,6 @@
319319
"contextcheck",
320320
"copyloopvar",
321321
"cyclop",
322-
"deadcode",
323322
"decorder",
324323
"depguard",
325324
"dogsled",
@@ -330,9 +329,7 @@
330329
"errchkjson",
331330
"errname",
332331
"errorlint",
333-
"execinquery",
334332
"exhaustive",
335-
"exhaustivestruct",
336333
"exhaustruct",
337334
"exportloopref",
338335
"fatcontext",
@@ -356,7 +353,6 @@
356353
"gofumpt",
357354
"goheader",
358355
"goimports",
359-
"golint",
360356
"gomoddirectives",
361357
"gomodguard",
362358
"goprintffuncname",
@@ -366,19 +362,16 @@
366362
"govet",
367363
"grouper",
368364
"iface",
369-
"ifshort",
370365
"importas",
371366
"inamedparam",
372367
"ineffassign",
373368
"interfacebloat",
374-
"interfacer",
375369
"intrange",
376370
"ireturn",
377371
"lll",
378372
"loggercheck",
379373
"maintidx",
380374
"makezero",
381-
"maligned",
382375
"mirror",
383376
"misspell",
384377
"mnd",
@@ -391,7 +384,6 @@
391384
"noctx",
392385
"nolintlint",
393386
"nonamedreturns",
394-
"nosnakecase",
395387
"nosprintfhostport",
396388
"paralleltest",
397389
"perfsprint",
@@ -403,11 +395,9 @@
403395
"recvcheck",
404396
"revive",
405397
"rowserrcheck",
406-
"scopelint",
407398
"sloglint",
408399
"sqlclosecheck",
409400
"staticcheck",
410-
"structcheck",
411401
"stylecheck",
412402
"tagalign",
413403
"tagliatelle",
@@ -421,7 +411,6 @@
421411
"unparam",
422412
"unused",
423413
"usestdlibvars",
424-
"varcheck",
425414
"varnamelen",
426415
"wastedassign",
427416
"whitespace",

Diff for: pkg/config/linters_settings.go

-9
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,6 @@ type LintersSettings struct {
229229
Gofumpt GofumptSettings
230230
Goheader GoHeaderSettings
231231
Goimports GoImportsSettings
232-
Gomnd GoMndSettings
233232
GoModDirectives GoModDirectivesSettings
234233
Gomodguard GoModGuardSettings
235234
Gosec GoSecSettings
@@ -570,14 +569,6 @@ type GoImportsSettings struct {
570569
LocalPrefixes string `mapstructure:"local-prefixes"`
571570
}
572571

573-
// Deprecated: use MndSettings.
574-
type GoMndSettings struct {
575-
MndSettings `mapstructure:",squash"`
576-
577-
// Deprecated: use root level settings instead.
578-
Settings map[string]map[string]any
579-
}
580-
581572
type GoModDirectivesSettings struct {
582573
ReplaceAllowList []string `mapstructure:"replace-allow-list"`
583574
ReplaceLocal bool `mapstructure:"replace-local"`

Diff for: pkg/config/loader.go

-6
Original file line numberDiff line numberDiff line change
@@ -413,12 +413,6 @@ func (l *Loader) handleLinterOptionDeprecations() {
413413
l.log.Warnf("The configuration option `linters.godot.check-all` is deprecated, please use `linters.godot.scope: all`.")
414414
}
415415

416-
// Deprecated since v1.44.0.
417-
if len(l.cfg.LintersSettings.Gomnd.Settings) > 0 {
418-
l.log.Warnf("The configuration option `linters.gomnd.settings` is deprecated. Please use the options " +
419-
"`linters.gomnd.checks`,`linters.gomnd.ignored-numbers`,`linters.gomnd.ignored-files`,`linters.gomnd.ignored-functions`.")
420-
}
421-
422416
// Deprecated since v1.47.0
423417
if l.cfg.LintersSettings.Gofumpt.LangVersion != "" {
424418
l.log.Warnf("The configuration option `linters.gofumpt.lang-version` is deprecated, please use global `run.go`.")

Diff for: pkg/golinters/execinquery/execinquery.go

-19
This file was deleted.

Diff for: pkg/golinters/execinquery/execinquery_integration_test.go

-11
This file was deleted.

Diff for: pkg/golinters/execinquery/testdata/execinquery.go

-30
This file was deleted.

Diff for: pkg/golinters/mnd/mnd.go

-21
Original file line numberDiff line numberDiff line change
@@ -12,27 +12,6 @@ func New(settings *config.MndSettings) *goanalysis.Linter {
1212
return newMND(mnd.Analyzer, settings, nil)
1313
}
1414

15-
func NewGoMND(settings *config.GoMndSettings) *goanalysis.Linter {
16-
// shallow copy because mnd.Analyzer is a global variable.
17-
a := new(analysis.Analyzer)
18-
*a = *mnd.Analyzer
19-
20-
// Used to force the analyzer name to use the same name as the linter.
21-
// This is required to avoid displaying the analyzer name inside the issue text.
22-
a.Name = "gomnd"
23-
24-
var linterCfg map[string]map[string]any
25-
26-
if settings != nil && len(settings.Settings) > 0 {
27-
// Convert deprecated setting.
28-
linterCfg = map[string]map[string]any{
29-
a.Name: settings.Settings["mnd"],
30-
}
31-
}
32-
33-
return newMND(a, &settings.MndSettings, linterCfg)
34-
}
35-
3615
func newMND(a *analysis.Analyzer, settings *config.MndSettings, linterCfg map[string]map[string]any) *goanalysis.Linter {
3716
if len(linterCfg) == 0 && settings != nil {
3817
cfg := make(map[string]any)

Diff for: pkg/lint/lintersdb/builder_linter.go

+4-5
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import (
2323
"github.com/golangci/golangci-lint/pkg/golinters/errchkjson"
2424
"github.com/golangci/golangci-lint/pkg/golinters/errname"
2525
"github.com/golangci/golangci-lint/pkg/golinters/errorlint"
26-
"github.com/golangci/golangci-lint/pkg/golinters/execinquery"
2726
"github.com/golangci/golangci-lint/pkg/golinters/exhaustive"
2827
"github.com/golangci/golangci-lint/pkg/golinters/exhaustruct"
2928
"github.com/golangci/golangci-lint/pkg/golinters/exportloopref"
@@ -250,12 +249,12 @@ func (LinterBuilder) Build(cfg *config.Config) ([]*linter.Config, error) {
250249
WithLoadForGoAnalysis().
251250
WithURL("https://github.com/polyfloyd/go-errorlint"),
252251

253-
linter.NewConfig(execinquery.New()).
252+
linter.NewConfig(linter.NewNoopDeprecated("execinquery", cfg, linter.DeprecationError)).
254253
WithSince("v1.46.0").
255254
WithPresets(linter.PresetSQL).
256255
WithLoadForGoAnalysis().
257256
WithURL("https://github.com/1uf3/execinquery").
258-
DeprecatedWarning("The repository of the linter has been archived by the owner.", "v1.58.0", ""),
257+
DeprecatedError("The repository of the linter has been archived by the owner.", "v1.58.0", ""),
259258

260259
linter.NewConfig(exhaustive.New(&cfg.LintersSettings.Exhaustive)).
261260
WithSince(" v1.28.0").
@@ -418,11 +417,11 @@ func (LinterBuilder) Build(cfg *config.Config) ([]*linter.Config, error) {
418417
WithPresets(linter.PresetStyle).
419418
WithURL("https://github.com/tommy-muehle/go-mnd"),
420419

421-
linter.NewConfig(mnd.NewGoMND(&cfg.LintersSettings.Gomnd)).
420+
linter.NewConfig(linter.NewNoopDeprecated("gomnd", cfg, linter.DeprecationError)).
422421
WithSince("v1.22.0").
423422
WithPresets(linter.PresetStyle).
424423
WithURL("https://github.com/tommy-muehle/go-mnd").
425-
DeprecatedWarning("The linter has been renamed.", "v1.58.0", "mnd"),
424+
DeprecatedError("The linter has been renamed.", "v1.58.0", "mnd"),
426425

427426
linter.NewConfig(gomoddirectives.New(&cfg.LintersSettings.GoModDirectives)).
428427
WithSince("v1.39.0").

0 commit comments

Comments
 (0)