package
0.31.0
Repository: https://go.googlesource.com/tools
Documentation: pkg.go.dev

# Functions

AddImport checks whether this file already imports pkgpath and that import is in scope at pos.
CanImport reports whether one package is allowed to import another.
CheckedReadFile returns a wrapper around a Pass.ReadFile function that performs the appropriate checks.
CheckReadable enforces the access policy defined by the ReadFile field of [analysis.Pass].
ExtractDoc extracts a section of a package doc comment from the provided contents of an analyzer package's doc.go file.
Format returns a string representation of the expression e.
Imports returns true if path is imported by pkg.
IsFunctionNamed reports whether obj is a package-level function defined in the given package and has one of the given names.
IsMethodNamed reports whether obj is a method defined on a package-level type with the given package and type name, and has one of the given names.
IsPointerToNamed reports whether t is (or is an alias for) a pointer to a package-level defined type with the given package path and one of the given names.
IsTypeNamed reports whether t is (or is an alias for) a package-level defined type with the given package path and one of the given names.
MatchingIdents finds the names of all identifiers in 'node' that match any of the given types.
MustExtractDoc is like [ExtractDoc] but it panics on error.
Deprecated: this heuristic is ill-defined.
ValidateFixes validates the set of fixes for a single diagnostic.
WalkASTWithParent walks the AST rooted at n.

# Type aliases

A ReadFileFunc is a function that returns the contents of a file, such as [os.ReadFile].