Skip to content

Commit 2dc7eba

Browse files
mvdanfindleyr
authored andcommitted
go/analysis: use parser.SkipObjectResolution
Neither of these two analysis passes relies on the now-deprecated object tracking in go/ast populated by go/parser. Change-Id: I8ec18d1552aedf437b2b663a2698010a6faee7c9 Reviewed-on: https://go-review.googlesource.com/c/tools/+/516575 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Robert Findley <rfindley@google.com> Run-TryBot: Robert Findley <rfindley@google.com> Run-TryBot: Daniel Martí <mvdan@mvdan.cc> gopls-CI: kokoro <noreply+kokoro@google.com> Reviewed-by: Alan Donovan <adonovan@google.com>
1 parent f91c023 commit 2dc7eba

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

go/analysis/passes/buildtag/buildtag.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ func runBuildTag(pass *analysis.Pass) (interface{}, error) {
4040
}
4141
for _, name := range pass.IgnoredFiles {
4242
if strings.HasSuffix(name, ".go") {
43-
f, err := parser.ParseFile(pass.Fset, name, nil, parser.ParseComments)
43+
f, err := parser.ParseFile(pass.Fset, name, nil, parser.ParseComments|parser.SkipObjectResolution)
4444
if err != nil {
4545
// Not valid Go source code - not our job to diagnose, so ignore.
4646
return nil, nil

go/analysis/passes/cgocall/cgocall.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ func typeCheckCgoSourceFiles(fset *token.FileSet, pkg *types.Package, files []*a
180180
// If f is a cgo-generated file, Position reports
181181
// the original file, honoring //line directives.
182182
filename := fset.Position(raw.Pos()).Filename
183-
f, err := parser.ParseFile(fset, filename, nil, parser.Mode(0))
183+
f, err := parser.ParseFile(fset, filename, nil, parser.SkipObjectResolution)
184184
if err != nil {
185185
return nil, nil, fmt.Errorf("can't parse raw cgo file: %v", err)
186186
}

0 commit comments

Comments
 (0)