Documentation ¶
Index ¶
Constants ¶
View Source
const MaxFileSize = 50 * 1024 * 1024 // 50 MB
Variables ¶
This section is empty.
Functions ¶
func Load ¶
func Load(spec *PackageSpec, opts *Options) (*Package, Stats, error)
Load loads the package described in spec. Imports will be loaded from export data, while the package itself will be loaded from source.
An error will only be returned for system failures, such as failure to read export data from disk. Syntax and type errors, among others, will only populate the returned package's Errors field.
Types ¶
type Options ¶
type Options struct { // The Go language version to use for the type checker. If unset, or if set // to "module", it will default to the Go version specified in the module; // if there is no module, it will default to the version of Go the // executable was built with. GoVersion string }
type Package ¶
type Package struct { *PackageSpec // Errors that occurred while loading the package. These will // primarily be parse or type errors, but may also be lower-level // failures such as file-system ones. Errors []packages.Error Types *types.Package Fset *token.FileSet Syntax []*ast.File TypesInfo *types.Info }
type PackageSpec ¶
type PackageSpec struct { ID string Name string PkgPath string // Errors that occurred while building the import graph. These will // primarily be parse errors or failure to resolve imports, but // may also be other errors. Errors []packages.Error GoFiles []string CompiledGoFiles []string OtherFiles []string ExportFile string Imports map[string]*PackageSpec TypesSizes types.Sizes Hash cache.ActionID Module *packages.Module Config config.Config }
func Graph ¶
Graph resolves patterns and returns packages with all the information required to later load type information, and optionally syntax trees.
The provided config can set any setting with the exception of Mode.
func (*PackageSpec) String ¶
func (spec *PackageSpec) String() string
Click to show internal directories.
Click to hide internal directories.