github.com/vanstinator/golangci-lint@v0.0.0-20240223191551-cc572f00d9d1/pkg/lint/lintersdb/manager.go (about)

     1  package lintersdb
     2  
     3  import (
     4  	"regexp"
     5  
     6  	"github.com/vanstinator/golangci-lint/pkg/config"
     7  	"github.com/vanstinator/golangci-lint/pkg/golinters"
     8  	"github.com/vanstinator/golangci-lint/pkg/lint/linter"
     9  	"github.com/vanstinator/golangci-lint/pkg/logutils"
    10  )
    11  
    12  type Manager struct {
    13  	cfg *config.Config
    14  	log logutils.Log
    15  
    16  	nameToLCs     map[string][]*linter.Config
    17  	customLinters []*linter.Config
    18  }
    19  
    20  func NewManager(cfg *config.Config, log logutils.Log) *Manager {
    21  	m := &Manager{cfg: cfg, log: log}
    22  	m.customLinters = m.getCustomLinterConfigs()
    23  
    24  	nameToLCs := make(map[string][]*linter.Config)
    25  	for _, lc := range m.GetAllSupportedLinterConfigs() {
    26  		for _, name := range lc.AllNames() {
    27  			nameToLCs[name] = append(nameToLCs[name], lc)
    28  		}
    29  	}
    30  
    31  	m.nameToLCs = nameToLCs
    32  
    33  	return m
    34  }
    35  
    36  func (Manager) AllPresets() []string {
    37  	return []string{
    38  		linter.PresetBugs,
    39  		linter.PresetComment,
    40  		linter.PresetComplexity,
    41  		linter.PresetError,
    42  		linter.PresetFormatting,
    43  		linter.PresetImport,
    44  		linter.PresetMetaLinter,
    45  		linter.PresetModule,
    46  		linter.PresetPerformance,
    47  		linter.PresetSQL,
    48  		linter.PresetStyle,
    49  		linter.PresetTest,
    50  		linter.PresetUnused,
    51  	}
    52  }
    53  
    54  func (m Manager) allPresetsSet() map[string]bool {
    55  	ret := map[string]bool{}
    56  	for _, p := range m.AllPresets() {
    57  		ret[p] = true
    58  	}
    59  	return ret
    60  }
    61  
    62  func (m Manager) GetLinterConfigs(name string) []*linter.Config {
    63  	return m.nameToLCs[name]
    64  }
    65  
    66  //nolint:funlen
    67  func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config {
    68  	var (
    69  		asasalintCfg        *config.AsasalintSettings
    70  		bidichkCfg          *config.BiDiChkSettings
    71  		cyclopCfg           *config.Cyclop
    72  		decorderCfg         *config.DecorderSettings
    73  		depGuardCfg         *config.DepGuardSettings
    74  		dogsledCfg          *config.DogsledSettings
    75  		duplCfg             *config.DuplSettings
    76  		dupwordCfg          *config.DupWordSettings
    77  		errcheckCfg         *config.ErrcheckSettings
    78  		errchkjsonCfg       *config.ErrChkJSONSettings
    79  		errorlintCfg        *config.ErrorLintSettings
    80  		exhaustiveCfg       *config.ExhaustiveSettings
    81  		exhaustiveStructCfg *config.ExhaustiveStructSettings
    82  		exhaustructCfg      *config.ExhaustructSettings
    83  		forbidigoCfg        *config.ForbidigoSettings
    84  		funlenCfg           *config.FunlenSettings
    85  		gciCfg              *config.GciSettings
    86  		ginkgolinterCfg     *config.GinkgoLinterSettings
    87  		gocognitCfg         *config.GocognitSettings
    88  		goconstCfg          *config.GoConstSettings
    89  		gocriticCfg         *config.GoCriticSettings
    90  		gocycloCfg          *config.GoCycloSettings
    91  		godotCfg            *config.GodotSettings
    92  		godoxCfg            *config.GodoxSettings
    93  		gofmtCfg            *config.GoFmtSettings
    94  		gofumptCfg          *config.GofumptSettings
    95  		goheaderCfg         *config.GoHeaderSettings
    96  		goimportsCfg        *config.GoImportsSettings
    97  		golintCfg           *config.GoLintSettings
    98  		goMndCfg            *config.GoMndSettings
    99  		goModDirectivesCfg  *config.GoModDirectivesSettings
   100  		gomodguardCfg       *config.GoModGuardSettings
   101  		gosecCfg            *config.GoSecSettings
   102  		gosimpleCfg         *config.StaticCheckSettings
   103  		gosmopolitanCfg     *config.GosmopolitanSettings
   104  		govetCfg            *config.GovetSettings
   105  		grouperCfg          *config.GrouperSettings
   106  		ifshortCfg          *config.IfshortSettings
   107  		importAsCfg         *config.ImportAsSettings
   108  		inamedparamCfg      *config.INamedParamSettings
   109  		interfaceBloatCfg   *config.InterfaceBloatSettings
   110  		ireturnCfg          *config.IreturnSettings
   111  		lllCfg              *config.LllSettings
   112  		loggerCheckCfg      *config.LoggerCheckSettings
   113  		maintIdxCfg         *config.MaintIdxSettings
   114  		makezeroCfg         *config.MakezeroSettings
   115  		malignedCfg         *config.MalignedSettings
   116  		misspellCfg         *config.MisspellSettings
   117  		musttagCfg          *config.MustTagSettings
   118  		nakedretCfg         *config.NakedretSettings
   119  		nestifCfg           *config.NestifSettings
   120  		nilNilCfg           *config.NilNilSettings
   121  		nlreturnCfg         *config.NlreturnSettings
   122  		noLintLintCfg       *config.NoLintLintSettings
   123  		noNamedReturnsCfg   *config.NoNamedReturnsSettings
   124  		nxBoundaryCfg 			*config.NxBoundarySettings
   125  		parallelTestCfg     *config.ParallelTestSettings
   126  		perfSprintCfg       *config.PerfSprintSettings
   127  		preallocCfg         *config.PreallocSettings
   128  		predeclaredCfg      *config.PredeclaredSettings
   129  		promlinterCfg       *config.PromlinterSettings
   130  		protogetterCfg      *config.ProtoGetterSettings
   131  		reassignCfg         *config.ReassignSettings
   132  		reviveCfg           *config.ReviveSettings
   133  		rowserrcheckCfg     *config.RowsErrCheckSettings
   134  		sloglintCfg         *config.SlogLintSettings
   135  		spancheckCfg        *config.SpancheckSettings
   136  		staticcheckCfg      *config.StaticCheckSettings
   137  		structcheckCfg      *config.StructCheckSettings
   138  		stylecheckCfg       *config.StaticCheckSettings
   139  		tagalignCfg         *config.TagAlignSettings
   140  		tagliatelleCfg      *config.TagliatelleSettings
   141  		tenvCfg             *config.TenvSettings
   142  		testifylintCfg      *config.TestifylintSettings
   143  		testpackageCfg      *config.TestpackageSettings
   144  		thelperCfg          *config.ThelperSettings
   145  		unparamCfg          *config.UnparamSettings
   146  		unusedCfg           *config.UnusedSettings
   147  		usestdlibvars       *config.UseStdlibVarsSettings
   148  		varcheckCfg         *config.VarCheckSettings
   149  		varnamelenCfg       *config.VarnamelenSettings
   150  		whitespaceCfg       *config.WhitespaceSettings
   151  		wrapcheckCfg        *config.WrapcheckSettings
   152  		wslCfg              *config.WSLSettings
   153  	)
   154  
   155  	if m.cfg != nil {
   156  		asasalintCfg = &m.cfg.LintersSettings.Asasalint
   157  		bidichkCfg = &m.cfg.LintersSettings.BiDiChk
   158  		cyclopCfg = &m.cfg.LintersSettings.Cyclop
   159  		decorderCfg = &m.cfg.LintersSettings.Decorder
   160  		depGuardCfg = &m.cfg.LintersSettings.Depguard
   161  		dogsledCfg = &m.cfg.LintersSettings.Dogsled
   162  		duplCfg = &m.cfg.LintersSettings.Dupl
   163  		dupwordCfg = &m.cfg.LintersSettings.DupWord
   164  		errcheckCfg = &m.cfg.LintersSettings.Errcheck
   165  		errchkjsonCfg = &m.cfg.LintersSettings.ErrChkJSON
   166  		errorlintCfg = &m.cfg.LintersSettings.ErrorLint
   167  		exhaustiveCfg = &m.cfg.LintersSettings.Exhaustive
   168  		exhaustiveStructCfg = &m.cfg.LintersSettings.ExhaustiveStruct
   169  		exhaustructCfg = &m.cfg.LintersSettings.Exhaustruct
   170  		forbidigoCfg = &m.cfg.LintersSettings.Forbidigo
   171  		funlenCfg = &m.cfg.LintersSettings.Funlen
   172  		gciCfg = &m.cfg.LintersSettings.Gci
   173  		ginkgolinterCfg = &m.cfg.LintersSettings.GinkgoLinter
   174  		gocognitCfg = &m.cfg.LintersSettings.Gocognit
   175  		goconstCfg = &m.cfg.LintersSettings.Goconst
   176  		gocriticCfg = &m.cfg.LintersSettings.Gocritic
   177  		gocycloCfg = &m.cfg.LintersSettings.Gocyclo
   178  		godotCfg = &m.cfg.LintersSettings.Godot
   179  		godoxCfg = &m.cfg.LintersSettings.Godox
   180  		gofmtCfg = &m.cfg.LintersSettings.Gofmt
   181  		gofumptCfg = &m.cfg.LintersSettings.Gofumpt
   182  		goheaderCfg = &m.cfg.LintersSettings.Goheader
   183  		goimportsCfg = &m.cfg.LintersSettings.Goimports
   184  		golintCfg = &m.cfg.LintersSettings.Golint
   185  		goMndCfg = &m.cfg.LintersSettings.Gomnd
   186  		goModDirectivesCfg = &m.cfg.LintersSettings.GoModDirectives
   187  		gomodguardCfg = &m.cfg.LintersSettings.Gomodguard
   188  		gosecCfg = &m.cfg.LintersSettings.Gosec
   189  		gosimpleCfg = &m.cfg.LintersSettings.Gosimple
   190  		gosmopolitanCfg = &m.cfg.LintersSettings.Gosmopolitan
   191  		govetCfg = &m.cfg.LintersSettings.Govet
   192  		grouperCfg = &m.cfg.LintersSettings.Grouper
   193  		ifshortCfg = &m.cfg.LintersSettings.Ifshort
   194  		importAsCfg = &m.cfg.LintersSettings.ImportAs
   195  		inamedparamCfg = &m.cfg.LintersSettings.Inamedparam
   196  		interfaceBloatCfg = &m.cfg.LintersSettings.InterfaceBloat
   197  		ireturnCfg = &m.cfg.LintersSettings.Ireturn
   198  		lllCfg = &m.cfg.LintersSettings.Lll
   199  		loggerCheckCfg = &m.cfg.LintersSettings.LoggerCheck
   200  		maintIdxCfg = &m.cfg.LintersSettings.MaintIdx
   201  		makezeroCfg = &m.cfg.LintersSettings.Makezero
   202  		malignedCfg = &m.cfg.LintersSettings.Maligned
   203  		misspellCfg = &m.cfg.LintersSettings.Misspell
   204  		musttagCfg = &m.cfg.LintersSettings.MustTag
   205  		nakedretCfg = &m.cfg.LintersSettings.Nakedret
   206  		nestifCfg = &m.cfg.LintersSettings.Nestif
   207  		nilNilCfg = &m.cfg.LintersSettings.NilNil
   208  		nlreturnCfg = &m.cfg.LintersSettings.Nlreturn
   209  		noLintLintCfg = &m.cfg.LintersSettings.NoLintLint
   210  		noNamedReturnsCfg = &m.cfg.LintersSettings.NoNamedReturns
   211  		nxBoundaryCfg = &m.cfg.LintersSettings.NxBoundary
   212  		parallelTestCfg = &m.cfg.LintersSettings.ParallelTest
   213  		perfSprintCfg = &m.cfg.LintersSettings.PerfSprint
   214  		preallocCfg = &m.cfg.LintersSettings.Prealloc
   215  		predeclaredCfg = &m.cfg.LintersSettings.Predeclared
   216  		promlinterCfg = &m.cfg.LintersSettings.Promlinter
   217  		protogetterCfg = &m.cfg.LintersSettings.ProtoGetter
   218  		reassignCfg = &m.cfg.LintersSettings.Reassign
   219  		reviveCfg = &m.cfg.LintersSettings.Revive
   220  		rowserrcheckCfg = &m.cfg.LintersSettings.RowsErrCheck
   221  		sloglintCfg = &m.cfg.LintersSettings.SlogLint
   222  		spancheckCfg = &m.cfg.LintersSettings.Spancheck
   223  		staticcheckCfg = &m.cfg.LintersSettings.Staticcheck
   224  		structcheckCfg = &m.cfg.LintersSettings.Structcheck
   225  		stylecheckCfg = &m.cfg.LintersSettings.Stylecheck
   226  		tagalignCfg = &m.cfg.LintersSettings.TagAlign
   227  		tagliatelleCfg = &m.cfg.LintersSettings.Tagliatelle
   228  		tenvCfg = &m.cfg.LintersSettings.Tenv
   229  		testifylintCfg = &m.cfg.LintersSettings.Testifylint
   230  		testpackageCfg = &m.cfg.LintersSettings.Testpackage
   231  		thelperCfg = &m.cfg.LintersSettings.Thelper
   232  		unparamCfg = &m.cfg.LintersSettings.Unparam
   233  		unusedCfg = &m.cfg.LintersSettings.Unused
   234  		usestdlibvars = &m.cfg.LintersSettings.UseStdlibVars
   235  		varcheckCfg = &m.cfg.LintersSettings.Varcheck
   236  		varnamelenCfg = &m.cfg.LintersSettings.Varnamelen
   237  		whitespaceCfg = &m.cfg.LintersSettings.Whitespace
   238  		wrapcheckCfg = &m.cfg.LintersSettings.Wrapcheck
   239  		wslCfg = &m.cfg.LintersSettings.WSL
   240  
   241  		if govetCfg != nil {
   242  			govetCfg.Go = m.cfg.Run.Go
   243  		}
   244  
   245  		if gocriticCfg != nil {
   246  			gocriticCfg.Go = trimGoVersion(m.cfg.Run.Go)
   247  		}
   248  
   249  		if gofumptCfg != nil && gofumptCfg.LangVersion == "" {
   250  			gofumptCfg.LangVersion = m.cfg.Run.Go
   251  		}
   252  
   253  		if staticcheckCfg != nil && staticcheckCfg.GoVersion == "" {
   254  			staticcheckCfg.GoVersion = trimGoVersion(m.cfg.Run.Go)
   255  		}
   256  		if gosimpleCfg != nil && gosimpleCfg.GoVersion == "" {
   257  			gosimpleCfg.GoVersion = trimGoVersion(m.cfg.Run.Go)
   258  		}
   259  		if stylecheckCfg != nil && stylecheckCfg.GoVersion != "" {
   260  			stylecheckCfg.GoVersion = trimGoVersion(m.cfg.Run.Go)
   261  		}
   262  	}
   263  
   264  	const megacheckName = "megacheck"
   265  
   266  	var linters []*linter.Config
   267  	linters = append(linters, m.customLinters...)
   268  
   269  	// The linters are sorted in the alphabetical order (case-insensitive).
   270  	// When a new linter is added the version in `WithSince(...)` must be the next minor version of golangci-lint.
   271  	linters = append(linters,
   272  		linter.NewConfig(golinters.NewAsasalint(asasalintCfg)).
   273  			WithSince("1.47.0").
   274  			WithPresets(linter.PresetBugs).
   275  			WithLoadForGoAnalysis().
   276  			WithURL("https://github.com/alingse/asasalint"),
   277  
   278  		linter.NewConfig(golinters.NewAsciicheck()).
   279  			WithSince("v1.26.0").
   280  			WithPresets(linter.PresetBugs, linter.PresetStyle).
   281  			WithURL("https://github.com/tdakkota/asciicheck"),
   282  
   283  		linter.NewConfig(golinters.NewBiDiChkFuncName(bidichkCfg)).
   284  			WithSince("1.43.0").
   285  			WithPresets(linter.PresetBugs).
   286  			WithURL("https://github.com/breml/bidichk"),
   287  
   288  		linter.NewConfig(golinters.NewBodyclose()).
   289  			WithSince("v1.18.0").
   290  			WithLoadForGoAnalysis().
   291  			WithPresets(linter.PresetPerformance, linter.PresetBugs).
   292  			WithURL("https://github.com/timakin/bodyclose"),
   293  
   294  		linter.NewConfig(golinters.NewContainedCtx()).
   295  			WithSince("1.44.0").
   296  			WithLoadForGoAnalysis().
   297  			WithPresets(linter.PresetStyle).
   298  			WithURL("https://github.com/sivchari/containedctx"),
   299  
   300  		linter.NewConfig(golinters.NewContextCheck()).
   301  			WithSince("v1.43.0").
   302  			WithPresets(linter.PresetBugs).
   303  			WithLoadForGoAnalysis().
   304  			WithURL("https://github.com/kkHAIKE/contextcheck"),
   305  
   306  		linter.NewConfig(golinters.NewCyclop(cyclopCfg)).
   307  			WithSince("v1.37.0").
   308  			WithLoadForGoAnalysis().
   309  			WithPresets(linter.PresetComplexity).
   310  			WithURL("https://github.com/bkielbasa/cyclop"),
   311  
   312  		linter.NewConfig(golinters.NewDecorder(decorderCfg)).
   313  			WithSince("v1.44.0").
   314  			WithPresets(linter.PresetFormatting, linter.PresetStyle).
   315  			WithURL("https://gitlab.com/bosi/decorder"),
   316  
   317  		linter.NewConfig(golinters.NewDeadcode()).
   318  			WithSince("v1.0.0").
   319  			WithLoadForGoAnalysis().
   320  			WithPresets(linter.PresetUnused).
   321  			WithURL("https://github.com/remyoudompheng/go-misc/tree/master/deadcode").
   322  			Deprecated("The owner seems to have abandoned the linter.", "v1.49.0", "unused"),
   323  
   324  		linter.NewConfig(golinters.NewDepguard(depGuardCfg)).
   325  			WithSince("v1.4.0").
   326  			WithPresets(linter.PresetStyle, linter.PresetImport, linter.PresetModule).
   327  			WithURL("https://github.com/OpenPeeDeeP/depguard"),
   328  
   329  		linter.NewConfig(golinters.NewDogsled(dogsledCfg)).
   330  			WithSince("v1.19.0").
   331  			WithPresets(linter.PresetStyle).
   332  			WithURL("https://github.com/alexkohler/dogsled"),
   333  
   334  		linter.NewConfig(golinters.NewDupl(duplCfg)).
   335  			WithSince("v1.0.0").
   336  			WithPresets(linter.PresetStyle).
   337  			WithURL("https://github.com/mibk/dupl"),
   338  
   339  		linter.NewConfig(golinters.NewDupWord(dupwordCfg)).
   340  			WithSince("1.50.0").
   341  			WithPresets(linter.PresetComment).
   342  			WithAutoFix().
   343  			WithURL("https://github.com/Abirdcfly/dupword"),
   344  
   345  		linter.NewConfig(golinters.NewDurationCheck()).
   346  			WithSince("v1.37.0").
   347  			WithPresets(linter.PresetBugs).
   348  			WithLoadForGoAnalysis().
   349  			WithURL("https://github.com/charithe/durationcheck"),
   350  
   351  		linter.NewConfig(golinters.NewErrcheck(errcheckCfg)).
   352  			WithEnabledByDefault().
   353  			WithSince("v1.0.0").
   354  			WithLoadForGoAnalysis().
   355  			WithPresets(linter.PresetBugs, linter.PresetError).
   356  			WithURL("https://github.com/kisielk/errcheck"),
   357  
   358  		linter.NewConfig(golinters.NewErrChkJSONFuncName(errchkjsonCfg)).
   359  			WithSince("1.44.0").
   360  			WithPresets(linter.PresetBugs).
   361  			WithLoadForGoAnalysis().
   362  			WithURL("https://github.com/breml/errchkjson"),
   363  
   364  		linter.NewConfig(golinters.NewErrName()).
   365  			WithSince("v1.42.0").
   366  			WithPresets(linter.PresetStyle).
   367  			WithLoadForGoAnalysis().
   368  			WithURL("https://github.com/Antonboom/errname"),
   369  
   370  		linter.NewConfig(golinters.NewErrorLint(errorlintCfg)).
   371  			WithSince("v1.32.0").
   372  			WithPresets(linter.PresetBugs, linter.PresetError).
   373  			WithLoadForGoAnalysis().
   374  			WithURL("https://github.com/polyfloyd/go-errorlint"),
   375  
   376  		linter.NewConfig(golinters.NewExecInQuery()).
   377  			WithSince("v1.46.0").
   378  			WithPresets(linter.PresetSQL).
   379  			WithLoadForGoAnalysis().
   380  			WithURL("https://github.com/lufeee/execinquery"),
   381  
   382  		linter.NewConfig(golinters.NewExhaustive(exhaustiveCfg)).
   383  			WithSince(" v1.28.0").
   384  			WithPresets(linter.PresetBugs).
   385  			WithLoadForGoAnalysis().
   386  			WithURL("https://github.com/nishanths/exhaustive"),
   387  
   388  		linter.NewConfig(golinters.NewExhaustiveStruct(exhaustiveStructCfg)).
   389  			WithSince("v1.32.0").
   390  			WithPresets(linter.PresetStyle, linter.PresetTest).
   391  			WithLoadForGoAnalysis().
   392  			WithURL("https://github.com/mbilski/exhaustivestruct").
   393  			Deprecated("The owner seems to have abandoned the linter.", "v1.46.0", "exhaustruct"),
   394  
   395  		linter.NewConfig(golinters.NewExhaustruct(exhaustructCfg)).
   396  			WithSince("v1.46.0").
   397  			WithPresets(linter.PresetStyle, linter.PresetTest).
   398  			WithLoadForGoAnalysis().
   399  			WithURL("https://github.com/GaijinEntertainment/go-exhaustruct"),
   400  
   401  		linter.NewConfig(golinters.NewExportLoopRef()).
   402  			WithSince("v1.28.0").
   403  			WithPresets(linter.PresetBugs).
   404  			WithLoadForGoAnalysis().
   405  			WithURL("https://github.com/kyoh86/exportloopref"),
   406  
   407  		linter.NewConfig(golinters.NewForbidigo(forbidigoCfg)).
   408  			WithSince("v1.34.0").
   409  			WithPresets(linter.PresetStyle).
   410  			// Strictly speaking,
   411  			// the additional information is only needed when forbidigoCfg.AnalyzeTypes is chosen by the user.
   412  			// But we don't know that here in all cases (sometimes config is not loaded),
   413  			// so we have to assume that it is needed to be on the safe side.
   414  			WithLoadForGoAnalysis().
   415  			WithURL("https://github.com/ashanbrown/forbidigo"),
   416  
   417  		linter.NewConfig(golinters.NewForceTypeAssert()).
   418  			WithSince("v1.38.0").
   419  			WithPresets(linter.PresetStyle).
   420  			WithURL("https://github.com/gostaticanalysis/forcetypeassert"),
   421  
   422  		linter.NewConfig(golinters.NewFunlen(funlenCfg)).
   423  			WithSince("v1.18.0").
   424  			WithPresets(linter.PresetComplexity).
   425  			WithURL("https://github.com/ultraware/funlen"),
   426  
   427  		linter.NewConfig(golinters.NewGci(gciCfg)).
   428  			WithSince("v1.30.0").
   429  			WithPresets(linter.PresetFormatting, linter.PresetImport).
   430  			WithURL("https://github.com/daixiang0/gci"),
   431  
   432  		linter.NewConfig(golinters.NewGinkgoLinter(ginkgolinterCfg)).
   433  			WithSince("v1.51.0").
   434  			WithLoadForGoAnalysis().
   435  			WithPresets(linter.PresetStyle).
   436  			WithURL("https://github.com/nunnatsa/ginkgolinter"),
   437  
   438  		linter.NewConfig(golinters.NewGoCheckCompilerDirectives()).
   439  			WithSince("v1.51.0").
   440  			WithPresets(linter.PresetBugs).
   441  			WithURL("https://github.com/leighmcculloch/gocheckcompilerdirectives"),
   442  
   443  		linter.NewConfig(golinters.NewGochecknoglobals()).
   444  			WithSince("v1.12.0").
   445  			WithPresets(linter.PresetStyle).
   446  			WithLoadForGoAnalysis().
   447  			WithURL("https://github.com/leighmcculloch/gochecknoglobals"),
   448  
   449  		linter.NewConfig(golinters.NewGochecknoinits()).
   450  			WithSince("v1.12.0").
   451  			WithPresets(linter.PresetStyle),
   452  
   453  		linter.NewConfig(golinters.NewGoCheckSumType()).
   454  			WithSince("v1.55.0").
   455  			WithPresets(linter.PresetBugs).
   456  			WithLoadForGoAnalysis().
   457  			WithURL("https://github.com/alecthomas/go-check-sumtype"),
   458  
   459  		linter.NewConfig(golinters.NewGocognit(gocognitCfg)).
   460  			WithSince("v1.20.0").
   461  			WithPresets(linter.PresetComplexity).
   462  			WithURL("https://github.com/uudashr/gocognit"),
   463  
   464  		linter.NewConfig(golinters.NewGoconst(goconstCfg)).
   465  			WithSince("v1.0.0").
   466  			WithPresets(linter.PresetStyle).
   467  			WithURL("https://github.com/jgautheron/goconst"),
   468  
   469  		linter.NewConfig(golinters.NewGoCritic(gocriticCfg, m.cfg)).
   470  			WithSince("v1.12.0").
   471  			WithPresets(linter.PresetStyle, linter.PresetMetaLinter).
   472  			WithLoadForGoAnalysis().
   473  			WithURL("https://github.com/go-critic/go-critic"),
   474  
   475  		linter.NewConfig(golinters.NewGocyclo(gocycloCfg)).
   476  			WithSince("v1.0.0").
   477  			WithPresets(linter.PresetComplexity).
   478  			WithURL("https://github.com/fzipp/gocyclo"),
   479  
   480  		linter.NewConfig(golinters.NewGodot(godotCfg)).
   481  			WithSince("v1.25.0").
   482  			WithPresets(linter.PresetStyle, linter.PresetComment).
   483  			WithAutoFix().
   484  			WithURL("https://github.com/tetafro/godot"),
   485  
   486  		linter.NewConfig(golinters.NewGodox(godoxCfg)).
   487  			WithSince("v1.19.0").
   488  			WithPresets(linter.PresetStyle, linter.PresetComment).
   489  			WithURL("https://github.com/matoous/godox"),
   490  
   491  		linter.NewConfig(golinters.NewGoerr113()).
   492  			WithSince("v1.26.0").
   493  			WithPresets(linter.PresetStyle, linter.PresetError).
   494  			WithLoadForGoAnalysis().
   495  			WithURL("https://github.com/Djarvur/go-err113"),
   496  
   497  		linter.NewConfig(golinters.NewGofmt(gofmtCfg)).
   498  			WithSince("v1.0.0").
   499  			WithPresets(linter.PresetFormatting).
   500  			WithAutoFix().
   501  			WithURL("https://pkg.go.dev/cmd/gofmt"),
   502  
   503  		linter.NewConfig(golinters.NewGofumpt(gofumptCfg)).
   504  			WithSince("v1.28.0").
   505  			WithPresets(linter.PresetFormatting).
   506  			WithAutoFix().
   507  			WithURL("https://github.com/mvdan/gofumpt"),
   508  
   509  		linter.NewConfig(golinters.NewGoHeader(goheaderCfg)).
   510  			WithSince("v1.28.0").
   511  			WithPresets(linter.PresetStyle).
   512  			WithURL("https://github.com/denis-tingaikin/go-header"),
   513  
   514  		linter.NewConfig(golinters.NewGoimports(goimportsCfg)).
   515  			WithSince("v1.20.0").
   516  			WithPresets(linter.PresetFormatting, linter.PresetImport).
   517  			WithAutoFix().
   518  			WithURL("https://pkg.go.dev/golang.org/x/tools/cmd/goimports"),
   519  
   520  		linter.NewConfig(golinters.NewGolint(golintCfg)).
   521  			WithSince("v1.0.0").
   522  			WithLoadForGoAnalysis().
   523  			WithPresets(linter.PresetStyle).
   524  			WithURL("https://github.com/golang/lint").
   525  			Deprecated("The repository of the linter has been archived by the owner.", "v1.41.0", "revive"),
   526  
   527  		linter.NewConfig(golinters.NewGoMND(goMndCfg)).
   528  			WithSince("v1.22.0").
   529  			WithPresets(linter.PresetStyle).
   530  			WithURL("https://github.com/tommy-muehle/go-mnd"),
   531  
   532  		linter.NewConfig(golinters.NewGoModDirectives(goModDirectivesCfg)).
   533  			WithSince("v1.39.0").
   534  			WithPresets(linter.PresetStyle, linter.PresetModule).
   535  			WithURL("https://github.com/ldez/gomoddirectives"),
   536  
   537  		linter.NewConfig(golinters.NewGomodguard(gomodguardCfg)).
   538  			WithSince("v1.25.0").
   539  			WithPresets(linter.PresetStyle, linter.PresetImport, linter.PresetModule).
   540  			WithURL("https://github.com/ryancurrah/gomodguard"),
   541  
   542  		linter.NewConfig(golinters.NewGoPrintfFuncName()).
   543  			WithSince("v1.23.0").
   544  			WithPresets(linter.PresetStyle).
   545  			WithURL("https://github.com/jirfag/go-printf-func-name"),
   546  
   547  		linter.NewConfig(golinters.NewGosec(gosecCfg)).
   548  			WithSince("v1.0.0").
   549  			WithLoadForGoAnalysis().
   550  			WithPresets(linter.PresetBugs).
   551  			WithURL("https://github.com/securego/gosec").
   552  			WithAlternativeNames("gas"),
   553  
   554  		linter.NewConfig(golinters.NewGosimple(gosimpleCfg)).
   555  			WithEnabledByDefault().
   556  			WithSince("v1.20.0").
   557  			WithLoadForGoAnalysis().
   558  			WithPresets(linter.PresetStyle).
   559  			WithAlternativeNames(megacheckName).
   560  			WithURL("https://github.com/dominikh/go-tools/tree/master/simple"),
   561  
   562  		linter.NewConfig(golinters.NewGosmopolitan(gosmopolitanCfg)).
   563  			WithSince("v1.53.0").
   564  			WithLoadForGoAnalysis().
   565  			WithPresets(linter.PresetBugs).
   566  			WithURL("https://github.com/xen0n/gosmopolitan"),
   567  
   568  		linter.NewConfig(golinters.NewGovet(govetCfg)).
   569  			WithEnabledByDefault().
   570  			WithSince("v1.0.0").
   571  			WithLoadForGoAnalysis().
   572  			WithPresets(linter.PresetBugs, linter.PresetMetaLinter).
   573  			WithAlternativeNames("vet", "vetshadow").
   574  			WithURL("https://pkg.go.dev/cmd/vet"),
   575  
   576  		linter.NewConfig(golinters.NewGrouper(grouperCfg)).
   577  			WithSince("v1.44.0").
   578  			WithPresets(linter.PresetStyle).
   579  			WithURL("https://github.com/leonklingele/grouper"),
   580  
   581  		linter.NewConfig(golinters.NewIfshort(ifshortCfg)).
   582  			WithSince("v1.36.0").
   583  			WithPresets(linter.PresetStyle).
   584  			WithURL("https://github.com/esimonov/ifshort").
   585  			Deprecated("The repository of the linter has been deprecated by the owner.", "v1.48.0", ""),
   586  
   587  		linter.NewConfig(golinters.NewImportAs(importAsCfg)).
   588  			WithSince("v1.38.0").
   589  			WithPresets(linter.PresetStyle).
   590  			WithLoadForGoAnalysis().
   591  			WithURL("https://github.com/julz/importas"),
   592  
   593  		linter.NewConfig(golinters.NewINamedParam(inamedparamCfg)).
   594  			WithSince("v1.55.0").
   595  			WithPresets(linter.PresetStyle).
   596  			WithURL("https://github.com/macabu/inamedparam"),
   597  
   598  		linter.NewConfig(golinters.NewIneffassign()).
   599  			WithEnabledByDefault().
   600  			WithSince("v1.0.0").
   601  			WithPresets(linter.PresetUnused).
   602  			WithURL("https://github.com/gordonklaus/ineffassign"),
   603  
   604  		linter.NewConfig(golinters.NewInterfaceBloat(interfaceBloatCfg)).
   605  			WithSince("v1.49.0").
   606  			WithPresets(linter.PresetStyle).
   607  			WithURL("https://github.com/sashamelentyev/interfacebloat"),
   608  
   609  		linter.NewConfig(golinters.NewInterfacer()).
   610  			WithSince("v1.0.0").
   611  			WithLoadForGoAnalysis().
   612  			WithPresets(linter.PresetStyle).
   613  			WithURL("https://github.com/mvdan/interfacer").
   614  			Deprecated("The repository of the linter has been archived by the owner.", "v1.38.0", ""),
   615  
   616  		linter.NewConfig(golinters.NewIreturn(ireturnCfg)).
   617  			WithSince("v1.43.0").
   618  			WithPresets(linter.PresetStyle).
   619  			WithLoadForGoAnalysis().
   620  			WithURL("https://github.com/butuzov/ireturn"),
   621  
   622  		linter.NewConfig(golinters.NewLLL(lllCfg)).
   623  			WithSince("v1.8.0").
   624  			WithPresets(linter.PresetStyle),
   625  
   626  		linter.NewConfig(golinters.NewLoggerCheck(loggerCheckCfg)).
   627  			WithSince("v1.49.0").
   628  			WithLoadForGoAnalysis().
   629  			WithPresets(linter.PresetStyle, linter.PresetBugs).
   630  			WithAlternativeNames("logrlint").
   631  			WithURL("https://github.com/timonwong/loggercheck"),
   632  
   633  		linter.NewConfig(golinters.NewMaintIdx(maintIdxCfg)).
   634  			WithSince("v1.44.0").
   635  			WithPresets(linter.PresetComplexity).
   636  			WithURL("https://github.com/yagipy/maintidx"),
   637  
   638  		linter.NewConfig(golinters.NewMakezero(makezeroCfg)).
   639  			WithSince("v1.34.0").
   640  			WithPresets(linter.PresetStyle, linter.PresetBugs).
   641  			WithLoadForGoAnalysis().
   642  			WithURL("https://github.com/ashanbrown/makezero"),
   643  
   644  		linter.NewConfig(golinters.NewMaligned(malignedCfg)).
   645  			WithSince("v1.0.0").
   646  			WithLoadForGoAnalysis().
   647  			WithPresets(linter.PresetPerformance).
   648  			WithURL("https://github.com/mdempsky/maligned").
   649  			Deprecated("The repository of the linter has been archived by the owner.", "v1.38.0", "govet 'fieldalignment'"),
   650  
   651  		linter.NewConfig(golinters.NewMirror()).
   652  			WithSince("v1.53.0").
   653  			WithPresets(linter.PresetStyle).
   654  			WithLoadForGoAnalysis().
   655  			WithURL("https://github.com/butuzov/mirror"),
   656  
   657  		linter.NewConfig(golinters.NewMisspell(misspellCfg)).
   658  			WithSince("v1.8.0").
   659  			WithPresets(linter.PresetStyle, linter.PresetComment).
   660  			WithAutoFix().
   661  			WithURL("https://github.com/client9/misspell"),
   662  
   663  		linter.NewConfig(golinters.NewMustTag(musttagCfg)).
   664  			WithSince("v1.51.0").
   665  			WithLoadForGoAnalysis().
   666  			WithPresets(linter.PresetStyle, linter.PresetBugs).
   667  			WithURL("https://github.com/go-simpler/musttag"),
   668  
   669  		linter.NewConfig(golinters.NewNakedret(nakedretCfg)).
   670  			WithSince("v1.19.0").
   671  			WithPresets(linter.PresetStyle).
   672  			WithURL("https://github.com/alexkohler/nakedret"),
   673  
   674  		linter.NewConfig(golinters.NewNestif(nestifCfg)).
   675  			WithSince("v1.25.0").
   676  			WithPresets(linter.PresetComplexity).
   677  			WithURL("https://github.com/nakabonne/nestif"),
   678  
   679  		linter.NewConfig(golinters.NewNilErr()).
   680  			WithSince("v1.38.0").
   681  			WithLoadForGoAnalysis().
   682  			WithPresets(linter.PresetBugs).
   683  			WithURL("https://github.com/gostaticanalysis/nilerr"),
   684  
   685  		linter.NewConfig(golinters.NewNilNil(nilNilCfg)).
   686  			WithSince("v1.43.0").
   687  			WithPresets(linter.PresetStyle).
   688  			WithLoadForGoAnalysis().
   689  			WithURL("https://github.com/Antonboom/nilnil"),
   690  
   691  		linter.NewConfig(golinters.NewNLReturn(nlreturnCfg)).
   692  			WithSince("v1.30.0").
   693  			WithPresets(linter.PresetStyle).
   694  			WithURL("https://github.com/ssgreg/nlreturn"),
   695  
   696  		linter.NewConfig(golinters.NewNoctx()).
   697  			WithSince("v1.28.0").
   698  			WithLoadForGoAnalysis().
   699  			WithPresets(linter.PresetPerformance, linter.PresetBugs).
   700  			WithURL("https://github.com/sonatard/noctx"),
   701  
   702  		linter.NewConfig(golinters.NewNoNamedReturns(noNamedReturnsCfg)).
   703  			WithSince("v1.46.0").
   704  			WithLoadForGoAnalysis().
   705  			WithPresets(linter.PresetStyle).
   706  			WithURL("https://github.com/firefart/nonamedreturns"),
   707  
   708  		linter.NewConfig(golinters.NewNxBoundary(nxBoundaryCfg)).
   709  			WithSince("v1.55.0").
   710  			WithPresets(linter.PresetStyle).
   711  			WithLoadForGoAnalysis().
   712  			WithURL("https://github.com/vanstinator/nxboundary"),
   713  
   714  		linter.NewConfig(golinters.NewNoSnakeCase()).
   715  			WithSince("v1.47.0").
   716  			WithPresets(linter.PresetStyle).
   717  			WithURL("https://github.com/sivchari/nosnakecase").
   718  			Deprecated("The repository of the linter has been deprecated by the owner.", "v1.48.1", "revive(var-naming)"),
   719  
   720  		linter.NewConfig(golinters.NewNoSprintfHostPort()).
   721  			WithSince("v1.46.0").
   722  			WithPresets(linter.PresetStyle).
   723  			WithURL("https://github.com/stbenjam/no-sprintf-host-port"),
   724  
   725  		linter.NewConfig(golinters.NewParallelTest(parallelTestCfg)).
   726  			WithSince("v1.33.0").
   727  			WithLoadForGoAnalysis().
   728  			WithPresets(linter.PresetStyle, linter.PresetTest).
   729  			WithURL("https://github.com/kunwardeep/paralleltest"),
   730  
   731  		linter.NewConfig(golinters.NewPerfSprint(perfSprintCfg)).
   732  			WithSince("v1.55.0").
   733  			WithLoadForGoAnalysis().
   734  			WithPresets(linter.PresetPerformance).
   735  			WithURL("https://github.com/catenacyber/perfsprint"),
   736  
   737  		linter.NewConfig(golinters.NewPreAlloc(preallocCfg)).
   738  			WithSince("v1.19.0").
   739  			WithPresets(linter.PresetPerformance).
   740  			WithURL("https://github.com/alexkohler/prealloc"),
   741  
   742  		linter.NewConfig(golinters.NewPredeclared(predeclaredCfg)).
   743  			WithSince("v1.35.0").
   744  			WithPresets(linter.PresetStyle).
   745  			WithURL("https://github.com/nishanths/predeclared"),
   746  
   747  		linter.NewConfig(golinters.NewPromlinter(promlinterCfg)).
   748  			WithSince("v1.40.0").
   749  			WithPresets(linter.PresetStyle).
   750  			WithURL("https://github.com/yeya24/promlinter"),
   751  
   752  		linter.NewConfig(golinters.NewProtoGetter(protogetterCfg)).
   753  			WithSince("v1.55.0").
   754  			WithPresets(linter.PresetBugs).
   755  			WithLoadForGoAnalysis().
   756  			WithAutoFix().
   757  			WithURL("https://github.com/ghostiam/protogetter"),
   758  
   759  		linter.NewConfig(golinters.NewReassign(reassignCfg)).
   760  			WithSince("1.49.0").
   761  			WithPresets(linter.PresetBugs).
   762  			WithLoadForGoAnalysis().
   763  			WithURL("https://github.com/curioswitch/go-reassign"),
   764  
   765  		linter.NewConfig(golinters.NewRevive(reviveCfg)).
   766  			WithSince("v1.37.0").
   767  			WithPresets(linter.PresetStyle, linter.PresetMetaLinter).
   768  			ConsiderSlow().
   769  			WithURL("https://github.com/mgechev/revive"),
   770  
   771  		linter.NewConfig(golinters.NewRowsErrCheck(rowserrcheckCfg)).
   772  			WithSince("v1.23.0").
   773  			WithLoadForGoAnalysis().
   774  			WithPresets(linter.PresetBugs, linter.PresetSQL).
   775  			WithURL("https://github.com/jingyugao/rowserrcheck"),
   776  
   777  		linter.NewConfig(golinters.NewSlogLint(sloglintCfg)).
   778  			WithSince("v1.55.0").
   779  			WithLoadForGoAnalysis().
   780  			WithPresets(linter.PresetStyle, linter.PresetFormatting).
   781  			WithURL("https://github.com/go-simpler/sloglint"),
   782  
   783  		linter.NewConfig(golinters.NewScopelint()).
   784  			WithSince("v1.12.0").
   785  			WithPresets(linter.PresetBugs).
   786  			WithURL("https://github.com/kyoh86/scopelint").
   787  			Deprecated("The repository of the linter has been deprecated by the owner.", "v1.39.0", "exportloopref"),
   788  
   789  		linter.NewConfig(golinters.NewSQLCloseCheck()).
   790  			WithSince("v1.28.0").
   791  			WithPresets(linter.PresetBugs, linter.PresetSQL).
   792  			WithLoadForGoAnalysis().
   793  			WithURL("https://github.com/ryanrolds/sqlclosecheck"),
   794  
   795  		linter.NewConfig(golinters.NewSpancheck(spancheckCfg)).
   796  			WithSince("v1.56.0").
   797  			WithLoadForGoAnalysis().
   798  			WithPresets(linter.PresetBugs).
   799  			WithURL("https://github.com/jjti/go-spancheck"),
   800  
   801  		linter.NewConfig(golinters.NewStaticcheck(staticcheckCfg)).
   802  			WithEnabledByDefault().
   803  			WithSince("v1.0.0").
   804  			WithLoadForGoAnalysis().
   805  			WithPresets(linter.PresetBugs, linter.PresetMetaLinter).
   806  			WithAlternativeNames(megacheckName).
   807  			WithURL("https://staticcheck.io/"),
   808  
   809  		linter.NewConfig(golinters.NewStructcheck(structcheckCfg)).
   810  			WithSince("v1.0.0").
   811  			WithLoadForGoAnalysis().
   812  			WithPresets(linter.PresetUnused).
   813  			WithURL("https://github.com/opennota/check").
   814  			Deprecated("The owner seems to have abandoned the linter.", "v1.49.0", "unused"),
   815  
   816  		linter.NewConfig(golinters.NewStylecheck(stylecheckCfg)).
   817  			WithSince("v1.20.0").
   818  			WithLoadForGoAnalysis().
   819  			WithPresets(linter.PresetStyle).
   820  			WithURL("https://github.com/dominikh/go-tools/tree/master/stylecheck"),
   821  
   822  		linter.NewConfig(golinters.NewTagAlign(tagalignCfg)).
   823  			WithSince("v1.53.0").
   824  			WithPresets(linter.PresetStyle, linter.PresetFormatting).
   825  			WithAutoFix().
   826  			WithURL("https://github.com/4meepo/tagalign"),
   827  
   828  		linter.NewConfig(golinters.NewTagliatelle(tagliatelleCfg)).
   829  			WithSince("v1.40.0").
   830  			WithPresets(linter.PresetStyle).
   831  			WithURL("https://github.com/ldez/tagliatelle"),
   832  
   833  		linter.NewConfig(golinters.NewTenv(tenvCfg)).
   834  			WithSince("v1.43.0").
   835  			WithPresets(linter.PresetStyle).
   836  			WithLoadForGoAnalysis().
   837  			WithURL("https://github.com/sivchari/tenv"),
   838  
   839  		linter.NewConfig(golinters.NewTestableexamples()).
   840  			WithSince("v1.50.0").
   841  			WithPresets(linter.PresetTest).
   842  			WithURL("https://github.com/maratori/testableexamples"),
   843  
   844  		linter.NewConfig(golinters.NewTestifylint(testifylintCfg)).
   845  			WithSince("v1.55.0").
   846  			WithPresets(linter.PresetTest, linter.PresetBugs).
   847  			WithLoadForGoAnalysis().
   848  			WithURL("https://github.com/Antonboom/testifylint"),
   849  
   850  		linter.NewConfig(golinters.NewTestpackage(testpackageCfg)).
   851  			WithSince("v1.25.0").
   852  			WithPresets(linter.PresetStyle, linter.PresetTest).
   853  			WithURL("https://github.com/maratori/testpackage"),
   854  
   855  		linter.NewConfig(golinters.NewThelper(thelperCfg)).
   856  			WithSince("v1.34.0").
   857  			WithPresets(linter.PresetStyle).
   858  			WithLoadForGoAnalysis().
   859  			WithURL("https://github.com/kulti/thelper"),
   860  
   861  		linter.NewConfig(golinters.NewTparallel()).
   862  			WithSince("v1.32.0").
   863  			WithPresets(linter.PresetStyle, linter.PresetTest).
   864  			WithLoadForGoAnalysis().
   865  			WithURL("https://github.com/moricho/tparallel"),
   866  
   867  		linter.NewConfig(golinters.NewTypecheck()).
   868  			WithInternal().
   869  			WithEnabledByDefault().
   870  			WithSince("v1.3.0").
   871  			WithLoadForGoAnalysis().
   872  			WithPresets(linter.PresetBugs).
   873  			WithURL(""),
   874  
   875  		linter.NewConfig(golinters.NewUnconvert()).
   876  			WithSince("v1.0.0").
   877  			WithLoadForGoAnalysis().
   878  			WithPresets(linter.PresetStyle).
   879  			WithURL("https://github.com/mdempsky/unconvert"),
   880  
   881  		linter.NewConfig(golinters.NewUnparam(unparamCfg)).
   882  			WithSince("v1.9.0").
   883  			WithPresets(linter.PresetUnused).
   884  			WithLoadForGoAnalysis().
   885  			WithURL("https://github.com/mvdan/unparam"),
   886  
   887  		linter.NewConfig(golinters.NewUnused(unusedCfg, staticcheckCfg)).
   888  			WithEnabledByDefault().
   889  			WithSince("v1.20.0").
   890  			WithLoadForGoAnalysis().
   891  			WithPresets(linter.PresetUnused).
   892  			WithAlternativeNames(megacheckName).
   893  			ConsiderSlow().
   894  			WithChangeTypes().
   895  			WithURL("https://github.com/dominikh/go-tools/tree/master/unused"),
   896  
   897  		linter.NewConfig(golinters.NewUseStdlibVars(usestdlibvars)).
   898  			WithSince("v1.48.0").
   899  			WithPresets(linter.PresetStyle).
   900  			WithURL("https://github.com/sashamelentyev/usestdlibvars"),
   901  
   902  		linter.NewConfig(golinters.NewVarcheck(varcheckCfg)).
   903  			WithSince("v1.0.0").
   904  			WithLoadForGoAnalysis().
   905  			WithPresets(linter.PresetUnused).
   906  			WithURL("https://github.com/opennota/check").
   907  			Deprecated("The owner seems to have abandoned the linter.", "v1.49.0", "unused"),
   908  
   909  		linter.NewConfig(golinters.NewVarnamelen(varnamelenCfg)).
   910  			WithSince("v1.43.0").
   911  			WithPresets(linter.PresetStyle).
   912  			WithLoadForGoAnalysis().
   913  			WithURL("https://github.com/blizzy78/varnamelen"),
   914  
   915  		linter.NewConfig(golinters.NewWastedAssign()).
   916  			WithSince("v1.38.0").
   917  			WithPresets(linter.PresetStyle).
   918  			WithLoadForGoAnalysis().
   919  			WithURL("https://github.com/sanposhiho/wastedassign"),
   920  
   921  		linter.NewConfig(golinters.NewWhitespace(whitespaceCfg)).
   922  			WithSince("v1.19.0").
   923  			WithPresets(linter.PresetStyle).
   924  			WithAutoFix().
   925  			WithURL("https://github.com/ultraware/whitespace"),
   926  
   927  		linter.NewConfig(golinters.NewWrapcheck(wrapcheckCfg)).
   928  			WithSince("v1.32.0").
   929  			WithPresets(linter.PresetStyle, linter.PresetError).
   930  			WithLoadForGoAnalysis().
   931  			WithURL("https://github.com/tomarrell/wrapcheck"),
   932  
   933  		linter.NewConfig(golinters.NewWSL(wslCfg)).
   934  			WithSince("v1.20.0").
   935  			WithPresets(linter.PresetStyle).
   936  			WithURL("https://github.com/bombsimon/wsl"),
   937  
   938  		linter.NewConfig(golinters.NewZerologLint()).
   939  			WithSince("v1.53.0").
   940  			WithPresets(linter.PresetBugs).
   941  			WithLoadForGoAnalysis().
   942  			WithURL("https://github.com/ykadowak/zerologlint"),
   943  
   944  		// nolintlint must be last because it looks at the results of all the previous linters for unused nolint directives
   945  		linter.NewConfig(golinters.NewNoLintLint(noLintLintCfg)).
   946  			WithSince("v1.26.0").
   947  			WithPresets(linter.PresetStyle).
   948  			WithURL("https://github.com/vanstinator/golangci-lint/blob/master/pkg/golinters/nolintlint/README.md"),
   949  	)
   950  
   951  	return linters
   952  }
   953  
   954  func (m Manager) GetAllEnabledByDefaultLinters() []*linter.Config {
   955  	var ret []*linter.Config
   956  	for _, lc := range m.GetAllSupportedLinterConfigs() {
   957  		if lc.EnabledByDefault {
   958  			ret = append(ret, lc)
   959  		}
   960  	}
   961  
   962  	return ret
   963  }
   964  
   965  func linterConfigsToMap(lcs []*linter.Config) map[string]*linter.Config {
   966  	ret := map[string]*linter.Config{}
   967  	for _, lc := range lcs {
   968  		lc := lc // local copy
   969  		ret[lc.Name()] = lc
   970  	}
   971  
   972  	return ret
   973  }
   974  
   975  func (m Manager) GetAllLinterConfigsForPreset(p string) []*linter.Config {
   976  	var ret []*linter.Config
   977  	for _, lc := range m.GetAllSupportedLinterConfigs() {
   978  		if lc.IsDeprecated() {
   979  			continue
   980  		}
   981  
   982  		for _, ip := range lc.InPresets {
   983  			if p == ip {
   984  				ret = append(ret, lc)
   985  				break
   986  			}
   987  		}
   988  	}
   989  
   990  	return ret
   991  }
   992  
   993  // Trims the Go version to keep only M.m.
   994  // Since Go 1.21 the version inside the go.mod can be a patched version (ex: 1.21.0).
   995  // https://go.dev/doc/toolchain#versions
   996  // This a problem with staticcheck and gocritic.
   997  func trimGoVersion(v string) string {
   998  	if v == "" {
   999  		return ""
  1000  	}
  1001  
  1002  	exp := regexp.MustCompile(`(\d\.\d+)(?:\.\d+|[a-z]+\d)`)
  1003  
  1004  	if exp.MatchString(v) {
  1005  		return exp.FindStringSubmatch(v)[1]
  1006  	}
  1007  
  1008  	return v
  1009  }