Documentation
¶
Index ¶
- func ClearPackageCache()
- func FindOriginalStartLine(diff []byte) int64
- func ParseAndTypeCheckFile(file string, collectors []filter.NodeCollector) (*ast.File, *token.FileSet, *types.Package, *types.Info, error)
- func ParseFile(file string) (*ast.File, *token.FileSet, error)
- func ParseSource(data interface{}) (*ast.File, *token.FileSet, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClearPackageCache ¶ added in v2.6.10
func ClearPackageCache()
ClearPackageCache resets the directory-level package-load cache. Call this in tests that need a clean state between ParseAndTypeCheckFile invocations.
func FindOriginalStartLine ¶
FindOriginalStartLine returns the original-file line number of the first changed line in a unified (`diff -u`) diff. It walks the body of the first hunk rather than assuming a fixed amount of leading context, so it stays correct when the change is near the top of the file (fewer than three context lines) or when a leading comment sits above the changed code — in both cases a fixed "header + 3" offset would point at the wrong line (often the comment). Returns 0 when no hunk header is found.
func ParseAndTypeCheckFile ¶
func ParseAndTypeCheckFile(file string, collectors []filter.NodeCollector) (*ast.File, *token.FileSet, *types.Package, *types.Info, error)
ParseAndTypeCheckFile parses and type-checks the given file, and returns everything interesting about the file. If a fatal error is encountered the error return argument is not nil.
Types ¶
This section is empty.