ast

package
v0.0.11 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 9, 2026 License: MIT Imports: 10 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadDirOptions

func LoadDirOptions() *loadDirOptions

Types

type File

type File interface {
	// relative to loading root
	RelPath() string
	Ast() *ast.File
	Content() []byte

	// has syntax error
	SyntaxError() error
}

type LoadInfo

type LoadInfo interface {
	FileSet() *token.FileSet
	RangeFiles(handler func(f File) bool)
}

LoadInfo is the core abstraction of an AST load

func FilterLoadInfo added in v0.0.11

func FilterLoadInfo(info LoadInfo, match func(string) bool) LoadInfo

FilterLoadInfo keeps filtering before annotation construction, not just before serialization. The backing AST is not copied and traversal stop semantics are preserved.

func LoadCode

func LoadCode(relPath string, code []byte) (LoadInfo, error)

func LoadDir

func LoadDir(dir string) (LoadInfo, error)

LoadDir scans a given directory to specify extra options, one can use:

LoadDirOptions().Exclude("vendor").Load("some/go_project")

func LoadFile added in v0.0.4

func LoadFile(dir string, relFile string) (LoadInfo, error)

func LoadFiles added in v0.0.4

func LoadFiles(dir string, relFiles []string) (LoadInfo, error)

func LoadProject added in v0.0.4

func LoadProject(dir string, args []string) (LoadInfo, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL