Skip to content

Commit ae2dc16

Browse files
committed
lintcmd: trim cache
Closes gh-1283 (cherry picked from commit ec2239c)
1 parent 7586196 commit ae2dc16

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

lintcmd/cmd.go

+1
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,7 @@ func (cmd *Command) exit(code int) {
537537
os.Exit(code)
538538
}
539539

540+
// printDiagnostics prints the diagnostics and exits the process.
540541
func (cmd *Command) printDiagnostics(cs []*lint.Analyzer, diagnostics []diagnostic) {
541542
if len(diagnostics) > 1 {
542543
sort.Slice(diagnostics, func(i, j int) bool {

lintcmd/lint.go

+3
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import (
3131
type linter struct {
3232
Analyzers map[string]*lint.Analyzer
3333
Runner *runner.Runner
34+
cache *cache.Cache
3435
}
3536

3637
func computeSalt() ([]byte, error) {
@@ -74,6 +75,7 @@ func newLinter(cfg config.Config) (*linter, error) {
7475
r.FallbackGoVersion = defaultGoVersion()
7576
return &linter{
7677
Runner: r,
78+
cache: c,
7779
}, nil
7880
}
7981

@@ -519,6 +521,7 @@ func doLint(as []*lint.Analyzer, paths []string, opt *options) (LintResult, erro
519521
if err != nil {
520522
return LintResult{}, err
521523
}
524+
defer l.cache.Trim()
522525
analyzers := make(map[string]*lint.Analyzer, len(as))
523526
for _, a := range as {
524527
analyzers[a.Analyzer.Name] = a

0 commit comments

Comments
 (0)