dev: clean context loader ()

This commit is contained in:
Ludovic Fernandez 2024-03-11 16:19:53 +01:00 committed by GitHub
parent 1aa28ec6a4
commit 6fda81008d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 75 additions and 82 deletions
pkg/commands

View file

@ -363,19 +363,18 @@ func (c *runCommand) runAnalysis(ctx context.Context, args []string) ([]result.I
c.reportData.AddLinter(lc.Name(), isEnabled, lc.EnabledByDefault)
}
lintCtx, err := c.contextLoader.Load(ctx, lintersToRun)
lintCtx, err := c.contextLoader.Load(ctx, c.log.Child(logutils.DebugKeyLintersContext), lintersToRun)
if err != nil {
return nil, fmt.Errorf("context loading failed: %w", err)
}
lintCtx.Log = c.log.Child(logutils.DebugKeyLintersContext)
runner, err := lint.NewRunner(c.log.Child(logutils.DebugKeyRunner),
c.cfg, c.goenv, c.lineCache, c.fileCache, c.dbManager, lintCtx.Packages)
c.cfg, c.goenv, c.lineCache, c.fileCache, c.dbManager, lintCtx)
if err != nil {
return nil, err
}
return runner.Run(ctx, lintersToRun, lintCtx)
return runner.Run(ctx, lintersToRun)
}
func (c *runCommand) setOutputToDevNull() (savedStdout, savedStderr *os.File) {