@@ -121,9 +121,9 @@ func (r *runner) makeAction(a *analysis.Analyzer, pkg *packages.Package,
121121 }
122122
123123 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
127127 act .isInitialPkg = initialPkgs [pkg ]
128128 act .needAnalyzeSource = initialPkgs [pkg ]
129129 act .analysisDoneCh = make (chan struct {})
@@ -132,11 +132,11 @@ func (r *runner) makeAction(a *analysis.Analyzer, pkg *packages.Package,
132132 if len (a .FactTypes ) > 0 {
133133 depsCount += len (pkg .Imports )
134134 }
135- act .deps = make ([]* action , 0 , depsCount )
135+ act .Deps = make ([]* action , 0 , depsCount )
136136
137137 // Add a dependency on each required analyzers.
138138 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 ))
140140 }
141141
142142 r .buildActionFactDeps (act , a , pkg , initialPkgs , actions , actAlloc )
@@ -162,7 +162,7 @@ func (r *runner) buildActionFactDeps(act *action, a *analysis.Analyzer, pkg *pac
162162 sort .Strings (paths ) // for determinism
163163 for _ , path := range paths {
164164 dep := r .makeAction (a , pkg .Imports [path ], initialPkgs , actions , actAlloc )
165- act .deps = append (act .deps , dep )
165+ act .Deps = append (act .Deps , dep )
166166 }
167167
168168 // Need to register fact types for pkgcache proper gob encoding.
@@ -203,7 +203,7 @@ func (r *runner) prepareAnalysis(pkgs []*packages.Package,
203203 for _ , a := range analyzers {
204204 for _ , pkg := range pkgs {
205205 root := r .makeAction (a , pkg , initialPkgs , actions , actAlloc )
206- root .isroot = true
206+ root .IsRoot = true
207207 roots = append (roots , root )
208208 }
209209 }
@@ -220,7 +220,7 @@ func (r *runner) analyze(pkgs []*packages.Package, analyzers []*analysis.Analyze
220220
221221 actionPerPkg := map [* packages.Package ][]* action {}
222222 for _ , act := range actions {
223- actionPerPkg [act .pkg ] = append (actionPerPkg [act .pkg ], act )
223+ actionPerPkg [act .Package ] = append (actionPerPkg [act .Package ], act )
224224 }
225225
226226 // Fill Imports field.
@@ -250,7 +250,7 @@ func (r *runner) analyze(pkgs []*packages.Package, analyzers []*analysis.Analyze
250250 }
251251 }
252252 for _ , act := range actions {
253- dfs (act .pkg )
253+ dfs (act .Package )
254254 }
255255
256256 // Limit memory and IO usage.
@@ -282,7 +282,7 @@ func extractDiagnostics(roots []*action) (retDiags []Diagnostic, retErrors []err
282282 for _ , act := range actions {
283283 if ! extracted [act ] {
284284 extracted [act ] = true
285- visitAll (act .deps )
285+ visitAll (act .Deps )
286286 extract (act )
287287 }
288288 }
@@ -299,31 +299,31 @@ func extractDiagnostics(roots []*action) (retDiags []Diagnostic, retErrors []err
299299 seen := make (map [key ]bool )
300300
301301 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 {
304304 panic (pe )
305305 }
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 ))
307307 return
308308 }
309309
310- if act .isroot {
311- for _ , diag := range act .diagnostics {
310+ if act .IsRoot {
311+ for _ , diag := range act .Diagnostics {
312312 // We don't display a.Name/f.Category
313313 // as most users don't care.
314314
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 }
317317 if seen [k ] {
318318 continue // duplicate
319319 }
320320 seen [k ] = true
321321
322322 retDiag := Diagnostic {
323323 Diagnostic : diag ,
324- Analyzer : act .a ,
324+ Analyzer : act .Analyzer ,
325325 Position : posn ,
326- Pkg : act .pkg ,
326+ Pkg : act .Package ,
327327 }
328328 retDiags = append (retDiags , retDiag )
329329 }
0 commit comments