mirror of
https://github.com/scratchfoundation/golangci-lint.git
synced 2025-08-28 22:28:43 -04:00
unused: support passing in options (#4086)
Co-authored-by: Fernandez Ludovic <ldez@users.noreply.github.com>
This commit is contained in:
parent
69d6cc93cb
commit
bce3dfd460
4 changed files with 83 additions and 25 deletions
|
@ -137,7 +137,7 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config {
|
|||
testpackageCfg *config.TestpackageSettings
|
||||
thelperCfg *config.ThelperSettings
|
||||
unparamCfg *config.UnparamSettings
|
||||
unusedCfg *config.StaticCheckSettings
|
||||
unusedCfg *config.UnusedSettings
|
||||
usestdlibvars *config.UseStdlibVarsSettings
|
||||
varcheckCfg *config.VarCheckSettings
|
||||
varnamelenCfg *config.VarnamelenSettings
|
||||
|
@ -218,7 +218,7 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config {
|
|||
testpackageCfg = &m.cfg.LintersSettings.Testpackage
|
||||
thelperCfg = &m.cfg.LintersSettings.Thelper
|
||||
unparamCfg = &m.cfg.LintersSettings.Unparam
|
||||
unusedCfg = new(config.StaticCheckSettings)
|
||||
unusedCfg = &m.cfg.LintersSettings.Unused
|
||||
usestdlibvars = &m.cfg.LintersSettings.UseStdlibVars
|
||||
varcheckCfg = &m.cfg.LintersSettings.Varcheck
|
||||
varnamelenCfg = &m.cfg.LintersSettings.Varnamelen
|
||||
|
@ -247,9 +247,6 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config {
|
|||
if stylecheckCfg != nil && stylecheckCfg.GoVersion != "" {
|
||||
stylecheckCfg.GoVersion = trimGoVersion(m.cfg.Run.Go)
|
||||
}
|
||||
if unusedCfg != nil && unusedCfg.GoVersion == "" {
|
||||
unusedCfg.GoVersion = trimGoVersion(m.cfg.Run.Go)
|
||||
}
|
||||
}
|
||||
|
||||
const megacheckName = "megacheck"
|
||||
|
@ -846,7 +843,7 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config {
|
|||
WithLoadForGoAnalysis().
|
||||
WithURL("https://github.com/mvdan/unparam"),
|
||||
|
||||
linter.NewConfig(golinters.NewUnused(unusedCfg)).
|
||||
linter.NewConfig(golinters.NewUnused(unusedCfg, staticcheckCfg)).
|
||||
WithEnabledByDefault().
|
||||
WithSince("v1.20.0").
|
||||
WithLoadForGoAnalysis().
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue