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

# Packages

The gopackages command is a diagnostic tool that demonstrates how to use golang.org/x/tools/go/packages to load, parse, type-check, and print one or more Go packages.
Package packagestest creates temporary projects on disk for testing go tools on.

# Functions

Load loads and returns the Go packages named by the given patterns.
PrintErrors prints to os.Stderr the accumulated errors of all packages in the import graph rooted at pkgs, dependencies first.
Visit visits all the packages in the import graph whose roots are pkgs, calling the optional pre function the first time each package is encountered (preorder), and the optional post function after a package's dependencies have been visited (postorder).

# Constants

No description provided by the author
LoadAllSyntax loads typed syntax for the initial packages and all dependencies.
LoadFiles loads the name and file names for the initial packages.
LoadImports loads the name, file names, and import mapping for the initial packages.
LoadSyntax loads typed syntax for the initial packages.
LoadTypes loads exported type information for the initial packages.
NeedCompiledGoFiles adds CompiledGoFiles.
NeedDeps adds the fields requested by the LoadMode in the packages in Imports.
NeedEmbedFiles adds EmbedFiles.
NeedEmbedPatterns adds EmbedPatterns.
NeedExportFile adds ExportFile.
Deprecated: NeedExportsFile is a historical misspelling of NeedExportFile.
NeedFiles adds Dir, GoFiles, OtherFiles, and IgnoredFiles.
NeedForTest adds ForTest.
NeedImports adds Imports.
NeedModule adds Module.
NeedName adds Name and PkgPath.
NeedSyntax adds Syntax and Fset.
NeedTarget adds Target.
NeedTypes adds Types, Fset, and IllTyped.
NeedTypesInfo adds TypesInfo and Fset.
NeedTypesSizes adds TypesSizes.
No description provided by the author
No description provided by the author
No description provided by the author

# Structs

A Config specifies details about how packages should be loaded.
DriverRequest defines the schema of a request for package metadata from an external driver program.
DriverResponse defines the schema of a response from an external driver program, providing the results of a query for package metadata.
An Error describes a problem with a package's metadata, syntax, or types.
Module provides module information for a package.
ModuleError holds errors loading a module.
A Package describes a loaded Go package.

# Type aliases

ErrorKind describes the source of the error, allowing the user to differentiate between errors generated by the driver, the parser, or the type-checker.
A LoadMode controls the amount of detail to return when loading.