Skip to content

Commit

Permalink
go/analysis: use parser.SkipObjectResolution
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Robert Findley <[email protected]>
Run-TryBot: Robert Findley <[email protected]>
Run-TryBot: Daniel Martí <[email protected]>
gopls-CI: kokoro <[email protected]>
Reviewed-by: Alan Donovan <[email protected]>
  • Loading branch information
mvdan authored and findleyr committed Aug 7, 2023
1 parent f91c023 commit 2dc7eba
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion go/analysis/passes/buildtag/buildtag.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func runBuildTag(pass *analysis.Pass) (interface{}, error) {
}
for _, name := range pass.IgnoredFiles {
if strings.HasSuffix(name, ".go") {
f, err := parser.ParseFile(pass.Fset, name, nil, parser.ParseComments)
f, err := parser.ParseFile(pass.Fset, name, nil, parser.ParseComments|parser.SkipObjectResolution)
if err != nil {
// Not valid Go source code - not our job to diagnose, so ignore.
return nil, nil
Expand Down
2 changes: 1 addition & 1 deletion go/analysis/passes/cgocall/cgocall.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ func typeCheckCgoSourceFiles(fset *token.FileSet, pkg *types.Package, files []*a
// If f is a cgo-generated file, Position reports
// the original file, honoring //line directives.
filename := fset.Position(raw.Pos()).Filename
f, err := parser.ParseFile(fset, filename, nil, parser.Mode(0))
f, err := parser.ParseFile(fset, filename, nil, parser.SkipObjectResolution)
if err != nil {
return nil, nil, fmt.Errorf("can't parse raw cgo file: %v", err)
}
Expand Down

0 comments on commit 2dc7eba

Please sign in to comment.