dev: remove Run.Args (#4525)
This commit is contained in:
parent
d37a3e0951
commit
a5e2fd817e
@ -369,8 +369,6 @@ func (c *runCommand) runAndPrint(ctx context.Context, args []string) error {
|
|||||||
|
|
||||||
// runAnalysis executes the linters that have been enabled in the configuration.
|
// runAnalysis executes the linters that have been enabled in the configuration.
|
||||||
func (c *runCommand) runAnalysis(ctx context.Context, args []string) ([]result.Issue, error) {
|
func (c *runCommand) runAnalysis(ctx context.Context, args []string) ([]result.Issue, error) {
|
||||||
c.cfg.Run.Args = args
|
|
||||||
|
|
||||||
lintersToRun, err := c.dbManager.GetOptimizedLinters()
|
lintersToRun, err := c.dbManager.GetOptimizedLinters()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -381,8 +379,8 @@ func (c *runCommand) runAnalysis(ctx context.Context, args []string) ([]result.I
|
|||||||
return nil, fmt.Errorf("context loading failed: %w", err)
|
return nil, fmt.Errorf("context loading failed: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
runner, err := lint.NewRunner(c.log.Child(logutils.DebugKeyRunner),
|
runner, err := lint.NewRunner(c.log.Child(logutils.DebugKeyRunner), c.cfg, args,
|
||||||
c.cfg, c.goenv, c.lineCache, c.fileCache, c.dbManager, lintCtx)
|
c.goenv, c.lineCache, c.fileCache, c.dbManager, lintCtx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -33,9 +33,6 @@ type Run struct {
|
|||||||
|
|
||||||
// Deprecated: use Output.ShowStats instead.
|
// Deprecated: use Output.ShowStats instead.
|
||||||
ShowStats bool `mapstructure:"show-stats"`
|
ShowStats bool `mapstructure:"show-stats"`
|
||||||
|
|
||||||
// Only used by skipDirs processor. TODO(ldez) remove it in next PR.
|
|
||||||
Args []string // Internal needs.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *Run) Validate() error {
|
func (r *Run) Validate() error {
|
||||||
|
@ -32,7 +32,7 @@ type Runner struct {
|
|||||||
Processors []processors.Processor
|
Processors []processors.Processor
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewRunner(log logutils.Log, cfg *config.Config, goenv *goutil.Env,
|
func NewRunner(log logutils.Log, cfg *config.Config, args []string, goenv *goutil.Env,
|
||||||
lineCache *fsutils.LineCache, fileCache *fsutils.FileCache,
|
lineCache *fsutils.LineCache, fileCache *fsutils.FileCache,
|
||||||
dbManager *lintersdb.Manager, lintCtx *linter.Context,
|
dbManager *lintersdb.Manager, lintCtx *linter.Context,
|
||||||
) (*Runner, error) {
|
) (*Runner, error) {
|
||||||
@ -51,7 +51,7 @@ func NewRunner(log logutils.Log, cfg *config.Config, goenv *goutil.Env,
|
|||||||
skipDirs = append(skipDirs, packages.StdExcludeDirRegexps...)
|
skipDirs = append(skipDirs, packages.StdExcludeDirRegexps...)
|
||||||
}
|
}
|
||||||
|
|
||||||
skipDirsProcessor, err := processors.NewSkipDirs(skipDirs, log.Child(logutils.DebugKeySkipDirs), cfg.Run.Args, cfg.Output.PathPrefix)
|
skipDirsProcessor, err := processors.NewSkipDirs(skipDirs, log.Child(logutils.DebugKeySkipDirs), args, cfg.Output.PathPrefix)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user