mirror of
https://github.com/scratchfoundation/golangci-lint.git
synced 2025-08-28 22:28:43 -04:00
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:
parent
fe494af887
commit
95ec0cf21e
74 changed files with 2497 additions and 2439 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue