Documentation ¶
Index ¶
Constants ¶
const ( NeedName = packages.NeedName NeedFiles = packages.NeedFiles NeedSyntax = packages.NeedSyntax NeedImports = packages.NeedImports NeedDeps = packages.NeedDeps NeedModule = packages.NeedModule NeedExportFile = packages.NeedExportFile NeedEmbedFiles = packages.NeedEmbedFiles NeedEmbedPatterns = packages.NeedEmbedPatterns NeedCompiledGoFiles = packages.NeedCompiledGoFiles NeedTypes = packages.NeedTypes NeedTypesSizes = packages.NeedTypesSizes NeedTypesInfo = packages.NeedTypesInfo )
const (
DebugPackagesLoad = false
)
Variables ¶
This section is empty.
Functions ¶
func Visit ¶
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). The boolean result of pre(pkg) determines whether the imports of package pkg are visited.
Types ¶
type Config ¶
A Config specifies details about how packages should be loaded. The zero value is a valid configuration. Calls to Load do not modify this struct.
type Deduper ¶ added in v0.8.8
type Deduper = *aDeduper
func NewDeduper ¶ added in v0.8.8
func NewDeduper() Deduper
func (Deduper) SetPkgPath ¶ added in v0.9.2
type LoadMode ¶
A LoadMode controls the amount of detail to return when loading. The bits below can be combined to specify which fields should be filled in the result packages. The zero value is a special case, equivalent to combining the NeedName, NeedFiles, and NeedCompiledGoFiles bits. ID and Errors (if present) will always be filled. Load may return more information than requested.
type Package ¶
A Package describes a loaded Go package.
func LoadEx ¶
func LoadEx(dedup Deduper, sizes func(types.Sizes) types.Sizes, cfg *Config, patterns ...string) ([]*Package, error)
LoadEx loads and returns the Go packages named by the given patterns.
Config specifies loading options; nil behaves the same as an empty Config.
If any of the patterns was invalid as defined by the underlying build system, Load returns an error. It may return an empty list of packages without an error, for instance for an empty expansion of a valid wildcard. Errors associated with a particular package are recorded in the corresponding Package's Errors list, and do not cause Load to return an error. Clients may need to handle such errors before proceeding with further analysis. The PrintErrors function is provided for convenient display of all errors.