...

Package modpkgload

import "cuelang.org/go/internal/mod/modpkgload"
Overview
Index

Overview ▾

func IsStdlibPackage

func IsStdlibPackage(pkgPath string) bool

type AmbiguousImportError

An AmbiguousImportError indicates an import of a package found in multiple modules in the build list, or found in both the main module and its vendor directory.

type AmbiguousImportError struct {
    ImportPath string
    Locations  [][]module.SourceLoc
    Modules    []module.Version // Either empty or 1:1 with Dirs.
}

func (*AmbiguousImportError) Error

func (e *AmbiguousImportError) Error() string

type Flags

Flags is a set of flags tracking metadata about a package.

type Flags int8
const (
    // PkgInAll indicates that the package is in the "all" package pattern,
    // regardless of whether we are loading the "all" package pattern.
    //
    // When the PkgInAll flag and PkgImportsLoaded flags are both set, the caller
    // who set the last of those flags must propagate the PkgInAll marking to all
    // of the imports of the marked package.
    PkgInAll Flags = 1 << iota

    // PkgIsRoot indicates that the package matches one of the root package
    // patterns requested by the caller.
    PkgIsRoot

    // PkgFromRoot indicates that the package is in the transitive closure of
    // imports starting at the roots. (Note that every package marked as PkgIsRoot
    // is also trivially marked PkgFromRoot.)
    PkgFromRoot

    // PkgImportsLoaded indicates that the Imports field of a
    // Pkg have been populated.
    PkgImportsLoaded
)

func (Flags) String

func (f Flags) String() string

type ImportMissingError

ImportMissingError is used for errors where an imported package cannot be found.

type ImportMissingError struct {
    Path string
}

func (*ImportMissingError) Error

func (e *ImportMissingError) Error() string

type Package

type Package struct {
    // contains filtered or unexported fields
}

func (*Package) Error

func (pkg *Package) Error() error

func (*Package) Flags

func (pkg *Package) Flags() Flags

func (*Package) FromExternalModule

func (pkg *Package) FromExternalModule() bool

func (*Package) HasFlags

func (pkg *Package) HasFlags(flags Flags) bool

func (*Package) ImportPath

func (pkg *Package) ImportPath() string

func (*Package) Imports

func (pkg *Package) Imports() []*Package

func (*Package) Locations

func (pkg *Package) Locations() []module.SourceLoc

func (*Package) Mod

func (pkg *Package) Mod() module.Version

func (*Package) SetError

func (pkg *Package) SetError(err error)

type Packages

type Packages struct {
    // contains filtered or unexported fields
}

func LoadPackages

func LoadPackages(
    ctx context.Context,
    mainModulePath string,
    mainModuleLoc module.SourceLoc,
    rs *modrequirements.Requirements,
    reg Registry,
    rootPkgPaths []string,
) *Packages

LoadPackages loads information about all the given packages and the packages they import, recursively, using modules from the given requirements to determine which modules they might be obtained from, and reg to download module contents.

func (*Packages) All

func (pkgs *Packages) All() []*Package

func (*Packages) Pkg

func (pkgs *Packages) Pkg(pkgPath string) *Package

func (*Packages) Roots

func (pkgs *Packages) Roots() []*Package

type Registry

Registry represents a module registry, or at least this package's view of it.

type Registry interface {
    // Fetch returns the location of the contents for the given module
    // version, downloading it if necessary.
    Fetch(ctx context.Context, m module.Version) (module.SourceLoc, error)
}