package modpkgload
import "cuelang.org/go/internal/mod/modpkgload"
Index ¶
- func IsStdlibPackage(pkgPath string) bool
- func OSDirFS(p string) fs.FS
- type AmbiguousImportError
- type Flags
- type ImportMissingError
- type OSRootFS
- type Package
- func (pkg *Package) Error() error
- func (pkg *Package) Flags() Flags
- func (pkg *Package) FromExternalModule() bool
- func (pkg *Package) HasFlags(flags Flags) bool
- func (pkg *Package) ImportPath() string
- func (pkg *Package) Imports() []*Package
- func (pkg *Package) Locations() []SourceLoc
- func (pkg *Package) Mod() module.Version
- func (pkg *Package) SetError(err error)
- type Packages
- func LoadPackages( ctx context.Context, mainModulePath string, mainModuleLoc SourceLoc, rs *modrequirements.Requirements, reg Registry, rootPkgPaths []string, ) *Packages
- func (pkgs *Packages) All() []*Package
- func (pkgs *Packages) Pkg(pkgPath string) *Package
- func (pkgs *Packages) Roots() []*Package
- type Registry
- type SourceLoc
Functions ¶
func IsStdlibPackage ¶
func OSDirFS ¶
OSDirFS is like os.DirFS but the returned value implements OSRootFS by returning p.
Types ¶
type AmbiguousImportError ¶
type AmbiguousImportError struct { ImportPath string Locations [][]SourceLoc Modules []module.Version // Either empty or 1:1 with Dirs. }
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.
func (*AmbiguousImportError) Error ¶
func (e *AmbiguousImportError) Error() string
type Flags ¶
type Flags int8
Flags is a set of flags tracking metadata about a package.
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 ¶
type ImportMissingError ¶
type ImportMissingError struct { Path string }
ImportMissingError is used for errors where an imported package cannot be found.
func (*ImportMissingError) Error ¶
func (e *ImportMissingError) Error() string
type OSRootFS ¶
type OSRootFS interface { fs.FS // OSRoot returns the root directory of the FS // as an OS file path. If it wasn't possible to do that, // it returns the empty string. OSRoot() string }
OSRootFS can be implemented by an fs.FS implementation to return its root directory as an OS file path.
type Package ¶
type Package struct {
// contains filtered or unexported fields
}
func (*Package) Error ¶
func (*Package) Flags ¶
func (*Package) FromExternalModule ¶
func (*Package) HasFlags ¶
func (*Package) ImportPath ¶
func (*Package) Imports ¶
func (*Package) Locations ¶
func (*Package) Mod ¶
func (*Package) SetError ¶
type Packages ¶
type Packages struct {
// contains filtered or unexported fields
}
func LoadPackages ¶
func LoadPackages( ctx context.Context, mainModulePath string, mainModuleLoc 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 (*Packages) Pkg ¶
func (*Packages) Roots ¶
type Registry ¶
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) (SourceLoc, error) }
Registry represents a module registry, or at least this package's view of it.
type SourceLoc ¶
type SourceLoc struct { // FS is the filesystem containing the source. FS fs.FS // Dir is the directory within the above filesystem. Dir string }
SourceLoc represents the location of some CUE source code.
Source Files ¶
dirfs.go import.go pkgload.go
- Version
- v0.8.0-alpha.2
- Published
- Feb 20, 2024
- Platform
- linux/amd64
- Imports
- 16 packages
- Last checked
- 2 hours ago –
Tools for package owners.