Skip to content

Commit 00feff8

Browse files
committed
chore: isolate code from x/tools
1 parent d88ac1a commit 00feff8

File tree

2 files changed

+25
-24
lines changed

2 files changed

+25
-24
lines changed

pkg/goanalysis/runner_action.go

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import (
77
"runtime/debug"
88

99
"golang.org/x/tools/go/analysis"
10-
"golang.org/x/tools/go/packages"
1110

1211
"github.com/golangci/golangci-lint/internal/errorutil"
1312
)
@@ -33,29 +32,6 @@ func (actAlloc *actionAllocator) alloc() *action {
3332
return act
3433
}
3534

36-
// An action represents one unit of analysis work: the application of
37-
// one analysis to one package. Actions form a DAG, both within a
38-
// package (as different analyzers are applied, either in sequence or
39-
// parallel), and across packages (as dependencies are analyzed).
40-
type action struct {
41-
a *analysis.Analyzer
42-
pkg *packages.Package
43-
pass *analysis.Pass
44-
deps []*action
45-
objectFacts map[objectFactKey]analysis.Fact
46-
packageFacts map[packageFactKey]analysis.Fact
47-
result any
48-
diagnostics []analysis.Diagnostic
49-
err error
50-
r *runner
51-
analysisDoneCh chan struct{}
52-
loadCachedFactsDone bool
53-
loadCachedFactsOk bool
54-
isroot bool
55-
isInitialPkg bool
56-
needAnalyzeSource bool
57-
}
58-
5935
func (act *action) waitUntilDependingAnalyzersWorked() {
6036
for _, dep := range act.deps {
6137
if dep.pkg == act.pkg {

pkg/goanalysis/runner_base.go

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,35 @@ import (
1717
"time"
1818

1919
"golang.org/x/tools/go/analysis"
20+
"golang.org/x/tools/go/packages"
2021

2122
"github.com/golangci/golangci-lint/pkg/goanalysis/pkgerrors"
2223
)
2324

25+
// NOTE(ldez) altered: custom fields; remove 'once' and 'duration'.
26+
// An action represents one unit of analysis work: the application of
27+
// one analysis to one package. Actions form a DAG, both within a
28+
// package (as different analyzers are applied, either in sequence or
29+
// parallel), and across packages (as dependencies are analyzed).
30+
type action struct {
31+
a *analysis.Analyzer
32+
pkg *packages.Package
33+
pass *analysis.Pass
34+
deps []*action
35+
objectFacts map[objectFactKey]analysis.Fact
36+
packageFacts map[packageFactKey]analysis.Fact
37+
result any
38+
diagnostics []analysis.Diagnostic
39+
err error
40+
r *runner
41+
analysisDoneCh chan struct{}
42+
loadCachedFactsDone bool
43+
loadCachedFactsOk bool
44+
isroot bool
45+
isInitialPkg bool
46+
needAnalyzeSource bool
47+
}
48+
2449
// NOTE(ldez) no alteration.
2550
type objectFactKey struct {
2651
obj types.Object

0 commit comments

Comments
 (0)