Skip to content

Commit b41e4b4

Browse files
committed
go/analysis: add Pass.OtherFiles field
This field lists the names of non-Go files that are part of the package under analysis. Change-Id: Ic967dc18b98e018c691442f7378cb29db30a1454 Reviewed-on: https://go-review.googlesource.com/138136 Reviewed-by: Michael Matloob <[email protected]>
1 parent d457fc8 commit b41e4b4

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

go/analysis/analysis.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,16 +90,19 @@ func (a *Analyzer) String() string { return a.Name }
9090
// program, and has both input and an output components.
9191
//
9292
// As in a compiler, one pass may depend on the result computed by another.
93+
//
94+
// The Run function should not call any of the Pass functions concurrently.
9395
type Pass struct {
9496
// -- inputs --
9597

9698
Analyzer *Analyzer // the identity of the current analyzer
9799

98100
// syntax and type information
99-
Fset *token.FileSet // file position information
100-
Files []*ast.File // the abstract syntax tree of each file
101-
Pkg *types.Package // type information about the package
102-
TypesInfo *types.Info // type information about the syntax trees
101+
Fset *token.FileSet // file position information
102+
Files []*ast.File // the abstract syntax tree of each file
103+
OtherFiles []string // names of non-Go files of this package
104+
Pkg *types.Package // type information about the package
105+
TypesInfo *types.Info // type information about the syntax trees
103106

104107
// ResultOf provides the inputs to this analysis pass, which are
105108
// the corresponding results of its prerequisite analyzers.

go/analysis/internal/checker/checker.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,7 @@ func (act *action) execOnce() {
497497
Analyzer: act.a,
498498
Fset: act.pkg.Fset,
499499
Files: act.pkg.Syntax,
500+
OtherFiles: act.pkg.OtherFiles,
500501
Pkg: act.pkg.Types,
501502
TypesInfo: act.pkg.TypesInfo,
502503
ResultOf: inputs,

0 commit comments

Comments
 (0)