modpkgload

package
v0.8.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsStdlibPackage

func IsStdlibPackage(pkgPath string) bool

Types

type AmbiguousImportError

type AmbiguousImportError struct {
	ImportPath string
	Locations  [][]module.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

func (f Flags) String() 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 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

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)
}

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL