Proposals Unofficial Go proposal tracker

Add deprecated ResolveFile to apply object resolution after parsing

#79802 · go/parser · low impact · Implemented in Go 1.28 ·

Legacy object resolution in go/parser is deprecated. It fills Ident.Obj and File.Scope and is skipped with the SkipObjectResolution mode flag. Some tools still need it occasionally, though. For example, gopls parses without resolution for speed, but must still resolve files before passing them to analyzers. To do that, it keeps its own copy of the parser's resolution algorithm.

The new deprecated function parser.ResolveFile exposes the parser's internal algorithm. It applies resolution to an already parsed file. It is idempotent: calling it more than once is safe, and a sync.Once inside ast.File guards the work.

f, err := parser.ParseFile(fset, "x.go", src, parser.SkipObjectResolution)
// ...later, only when needed:
parser.ResolveFile(f) // fills f.Scope and Ident.Obj

New code should use go/types instead. The function exists to ease migration for programs that disable resolution by default.

Proposal
#79802 by adonovan
Status
Implemented on Jul 20, 2026
Release
Go 1.28
Impact
low
Area
go/parser