dramatically reduce memory usage (#758)

Run all linters per package. It allows unloading package data when it's
processed. It dramatically reduces memory (and CPU because of GC) usage.

Relates: #337
This commit is contained in:
Isaev Denis 2019-09-30 16:19:41 +03:00 committed by GitHub
parent fe494af887
commit 95ec0cf21e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
74 changed files with 2497 additions and 2439 deletions

View file

@ -1,9 +1,9 @@
package linter
import (
"golang.org/x/tools/go/loader"
"golang.org/x/tools/go/packages"
"golang.org/x/tools/go/ssa"
"github.com/golangci/golangci-lint/pkg/lint/astcache"
"github.com/golangci/golangci-lint/pkg/golinters/goanalysis/load"
@ -12,7 +12,6 @@ import (
"github.com/golangci/golangci-lint/pkg/fsutils"
"github.com/golangci/golangci-lint/pkg/config"
"github.com/golangci/golangci-lint/pkg/lint/astcache"
"github.com/golangci/golangci-lint/pkg/logutils"
)
@ -24,22 +23,14 @@ type Context struct {
// version for each of packages
OriginalPackages []*packages.Package
NotCompilingPackages []*packages.Package
LoaderConfig *loader.Config // deprecated, don't use for new linters
Program *loader.Program // deprecated, use Packages for new linters
SSAProgram *ssa.Program // for unparam and interfacer but not for megacheck (it change it)
Cfg *config.Config
ASTCache *astcache.Cache
FileCache *fsutils.FileCache
LineCache *fsutils.LineCache
Log logutils.Log
PkgCache *pkgcache.Cache
LoadGuard *load.Guard
NeedWholeProgram bool
PkgCache *pkgcache.Cache
LoadGuard *load.Guard
ASTCache *astcache.Cache
}
func (c *Context) Settings() *config.LintersSettings {