type go/ast.File
85 uses
go/ast (current package)
ast.go#L1064: type File struct {
ast.go#L1082: func (f *File) Pos() token.Pos { return f.Package }
ast.go#L1088: func (f *File) End() token.Pos {
ast.go#L1103: Files map[string]*File // Go source files by filename
ast.go#L1119: func IsGenerated(file *File) bool {
ast.go#L1124: func generator(file *File) (string, bool) {
commentmap.go#L218: case *File, *Field, Decl, Spec, Stmt:
filter.go#L27: func FileExports(src *File) bool {
filter.go#L256: func FilterFile(src *File, f Filter) bool {
filter.go#L260: func filterFile(src *File, f Filter, export bool) bool {
filter.go#L349: func MergePackageFiles(pkg *Package, mode MergeMode) *File {
filter.go#L508: return &File{doc, pos, NewIdent(pkg.Name), decls, minPos, maxPos, pkg.Scope, imports, nil, comments, ""}
import.go#L16: func SortImports(fset *token.FileSet, f *File) {
import.go#L112: func sortSpecs(fset *token.FileSet, f *File, d *GenDecl, specs []Spec) []Spec {
resolve.go#L77: func NewPackage(fset *token.FileSet, files map[string]*File, importer Importer, universe *Scope) (*Package, error) {
walk.go#L336: case *File:
go/build
build.go#L1420: parsed *ast.File
go/doc
doc.go#L256: func NewFromFiles(fset *token.FileSet, files []*ast.File, importPath string, opts ...any) (*Package, error) {
doc.go#L278: goFiles = make(map[string]*ast.File)
doc.go#L279: testGoFiles []*ast.File
example.go#L27: Play *ast.File // a whole program version of the example
example.go#L50: func Examples(testFiles ...*ast.File) []*Example {
example.go#L155: func playExample(file *ast.File, f *ast.FuncDecl) *ast.File {
example.go#L323: return &ast.File{
example.go#L545: func playExampleFile(file *ast.File) *ast.File {
exports.go#L315: func (r *reader) fileExports(src *ast.File) {
reader.go#L562: func (r *reader) readFile(src *ast.File) {
go/format
format.go#L55: var file *ast.File
format.go#L58: case *ast.File:
format.go#L61: if f, ok := n.Node.(*ast.File); ok {
format.go#L117: func hasUnsortedImports(file *ast.File) bool {
internal.go#L24: file *ast.File,
internal.go#L96: file *ast.File,
go/parser
interface.go#L84: func ParseFile(fset *token.FileSet, filename string, src any, mode Mode) (f *ast.File, err error) {
interface.go#L114: f = &ast.File{
interface.go#L180: Files: make(map[string]*ast.File),
parser.go#L2876: func (p *parser) parseFile() *ast.File {
parser.go#L2926: f := &ast.File{
resolver.go#L21: func resolveFile(file *ast.File, handle *token.File, declErr func(token.Pos, string)) {
go/printer
nodes.go#L1992: func (p *printer) file(src *ast.File) {
printer.go#L1063: case *ast.File:
printer.go#L1083: case *ast.File:
printer.go#L1132: } else if n, ok := node.(*ast.File); ok {
printer.go#L1171: case *ast.File:
go/types
api.go#L337: FileVersions map[*ast.File]string
api.go#L490: func (conf *Config) Check(path string, fset *token.FileSet, files []*ast.File, info *Info) (*Package, error) {
check.go#L184: files []*ast.File // package files
check.go#L185: versions map[*ast.File]string // maps files to goVersion strings (each file has an entry); shared with Info.FileVersions if present; may be unaltered Config.GoVersion
check.go#L337: func (check *Checker) initFiles(files []*ast.File) {
check.go#L384: versions = make(map[*ast.File]string)
check.go#L478: func (check *Checker) Files(files []*ast.File) (err error) {
check.go#L499: func (check *Checker) checkFiles(files []*ast.File) {
go.pact.im/x/plumb/internal/discover
discover.go#L106: for _, file := range slices.SortedFunc(slices.Values(pkg.Syntax), func(a, b *ast.File) int {
discover.go#L123: func FileBase(pkg *Package, file *ast.File) string {
discover.go#L141: func scanFile(pkg *Package, file *ast.File) ([]*Provider, *diag.Error) {
discover.go#L179: func reportStrayDirectives(pkg *Package, file *ast.File) *diag.Error {
discover.go#L202: func collectProviderDocs(file *ast.File) map[*ast.CommentGroup]bool {
provider.go#L25: Syntax []*ast.File
go.pact.im/x/plumb/internal/gen
gen.go#L147: files := slices.SortedFunc(slices.Values(pkg.Syntax), func(a, b *ast.File) int {
go.pact.im/x/plumb/internal/gopackages
gopackages.go#L116: func parseFile(fset *token.FileSet, filename string, src []byte) (*ast.File, error) {
go.pact.im/x/plumb/internal/packagestest
packagestest.go#L103: parsed := map[string][]*ast.File{} // import path → files
packagestest.go#L127: parsed[ip] = []*ast.File{f}
packagestest.go#L176: parsed map[string][]*ast.File
golang.org/x/tools/go/ast/edge
edge.go#L223: File_Decls: info[*ast.File]("Decls"),
edge.go#L224: File_Doc: info[*ast.File]("Doc"),
edge.go#L225: File_Name: info[*ast.File]("Name"),
golang.org/x/tools/go/ast/inspector
cursor.go#L505: if file, ok := n.(*ast.File); ok {
inspector.go#L73: func New(files []*ast.File) *Inspector {
inspector.go#L230: func traverse(files []*ast.File) []event {
typeof.go#L148: case *ast.File:
walk.go#L325: case *ast.File:
golang.org/x/tools/go/packages
packages.go#L203: ParseFile func(fset *token.FileSet, filename string, src []byte) (*ast.File, error)
packages.go#L526: Syntax []*ast.File `json:"-"`
packages.go#L722: f *ast.File
packages.go#L772: ld.ParseFile = func(fset *token.FileSet, filename string, src []byte) (*ast.File, error) {
packages.go#L1055: lpkg.Syntax = []*ast.File{}
packages.go#L1344: FileVersions: make(map[*ast.File]string),
packages.go#L1361: func (ld *loader) parseFile(filename string) (*ast.File, error) {
packages.go#L1411: func (ld *loader) parseFiles(filenames []string) ([]*ast.File, []error) {
packages.go#L1414: parsed = make([]*ast.File, n)
golang.org/x/tools/internal/typesinternal
qualifier.go#L26: func FileQualifier(f *ast.File, pkg *types.Package) types.Qualifier {
types.go#L167: FileVersions: map[*ast.File]string{},
golang.org/x/tools/internal/versions
types.go#L15: func FileVersion(info *types.Info, file *ast.File) string {