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 <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>
  • 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
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
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.