Documentation ¶
Index ¶
Constants ¶
View Source
const MaxFileSize = 50 * 1024 * 1024 // 50 MB
Variables ¶
This section is empty.
Functions ¶
func Load ¶
func Load(spec *PackageSpec) (*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 Package ¶
type Package struct { *PackageSpec // Errors that occured 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 occured 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 Config config.Config }
func Graph ¶
func Graph(cfg *packages.Config, patterns ...string) ([]*PackageSpec, error)
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.