@@ -121,9 +121,9 @@ func (r *runner) makeAction(a *analysis.Analyzer, pkg *packages.Package,
121
121
}
122
122
123
123
act = actAlloc .alloc ()
124
- act .a = a
125
- act .pkg = pkg
126
- act .r = r
124
+ act .Analyzer = a
125
+ act .Package = pkg
126
+ act .runner = r
127
127
act .isInitialPkg = initialPkgs [pkg ]
128
128
act .needAnalyzeSource = initialPkgs [pkg ]
129
129
act .analysisDoneCh = make (chan struct {})
@@ -132,11 +132,11 @@ func (r *runner) makeAction(a *analysis.Analyzer, pkg *packages.Package,
132
132
if len (a .FactTypes ) > 0 {
133
133
depsCount += len (pkg .Imports )
134
134
}
135
- act .deps = make ([]* action , 0 , depsCount )
135
+ act .Deps = make ([]* action , 0 , depsCount )
136
136
137
137
// Add a dependency on each required analyzers.
138
138
for _ , req := range a .Requires {
139
- act .deps = append (act .deps , r .makeAction (req , pkg , initialPkgs , actions , actAlloc ))
139
+ act .Deps = append (act .Deps , r .makeAction (req , pkg , initialPkgs , actions , actAlloc ))
140
140
}
141
141
142
142
r .buildActionFactDeps (act , a , pkg , initialPkgs , actions , actAlloc )
@@ -162,7 +162,7 @@ func (r *runner) buildActionFactDeps(act *action, a *analysis.Analyzer, pkg *pac
162
162
sort .Strings (paths ) // for determinism
163
163
for _ , path := range paths {
164
164
dep := r .makeAction (a , pkg .Imports [path ], initialPkgs , actions , actAlloc )
165
- act .deps = append (act .deps , dep )
165
+ act .Deps = append (act .Deps , dep )
166
166
}
167
167
168
168
// Need to register fact types for pkgcache proper gob encoding.
@@ -203,7 +203,7 @@ func (r *runner) prepareAnalysis(pkgs []*packages.Package,
203
203
for _ , a := range analyzers {
204
204
for _ , pkg := range pkgs {
205
205
root := r .makeAction (a , pkg , initialPkgs , actions , actAlloc )
206
- root .isroot = true
206
+ root .IsRoot = true
207
207
roots = append (roots , root )
208
208
}
209
209
}
@@ -220,7 +220,7 @@ func (r *runner) analyze(pkgs []*packages.Package, analyzers []*analysis.Analyze
220
220
221
221
actionPerPkg := map [* packages.Package ][]* action {}
222
222
for _ , act := range actions {
223
- actionPerPkg [act .pkg ] = append (actionPerPkg [act .pkg ], act )
223
+ actionPerPkg [act .Package ] = append (actionPerPkg [act .Package ], act )
224
224
}
225
225
226
226
// Fill Imports field.
@@ -250,7 +250,7 @@ func (r *runner) analyze(pkgs []*packages.Package, analyzers []*analysis.Analyze
250
250
}
251
251
}
252
252
for _ , act := range actions {
253
- dfs (act .pkg )
253
+ dfs (act .Package )
254
254
}
255
255
256
256
// Limit memory and IO usage.
@@ -282,7 +282,7 @@ func extractDiagnostics(roots []*action) (retDiags []Diagnostic, retErrors []err
282
282
for _ , act := range actions {
283
283
if ! extracted [act ] {
284
284
extracted [act ] = true
285
- visitAll (act .deps )
285
+ visitAll (act .Deps )
286
286
extract (act )
287
287
}
288
288
}
@@ -299,31 +299,31 @@ func extractDiagnostics(roots []*action) (retDiags []Diagnostic, retErrors []err
299
299
seen := make (map [key ]bool )
300
300
301
301
extract = func (act * action ) {
302
- if act .err != nil {
303
- if pe , ok := act .err .(* errorutil.PanicError ); ok {
302
+ if act .Err != nil {
303
+ if pe , ok := act .Err .(* errorutil.PanicError ); ok {
304
304
panic (pe )
305
305
}
306
- retErrors = append (retErrors , fmt .Errorf ("%s: %w" , act .a .Name , act .err ))
306
+ retErrors = append (retErrors , fmt .Errorf ("%s: %w" , act .Analyzer .Name , act .Err ))
307
307
return
308
308
}
309
309
310
- if act .isroot {
311
- for _ , diag := range act .diagnostics {
310
+ if act .IsRoot {
311
+ for _ , diag := range act .Diagnostics {
312
312
// We don't display a.Name/f.Category
313
313
// as most users don't care.
314
314
315
- posn := act .pkg .Fset .Position (diag .Pos )
316
- k := key {posn , act .a , diag .Message }
315
+ posn := act .Package .Fset .Position (diag .Pos )
316
+ k := key {posn , act .Analyzer , diag .Message }
317
317
if seen [k ] {
318
318
continue // duplicate
319
319
}
320
320
seen [k ] = true
321
321
322
322
retDiag := Diagnostic {
323
323
Diagnostic : diag ,
324
- Analyzer : act .a ,
324
+ Analyzer : act .Analyzer ,
325
325
Position : posn ,
326
- Pkg : act .pkg ,
326
+ Pkg : act .Package ,
327
327
}
328
328
retDiags = append (retDiags , retDiag )
329
329
}
0 commit comments