Documentation ¶
Index ¶
- func ParseFileImports(filename, moduleUrl string, code []byte) ([]string, error)
- type HostFS
- type MemoryPackageIndex
- type PMProgressObserver
- type PackageCache
- type PackageIndex
- type PackageManager
- type Progress
- type SimpleFSCache
- func (c SimpleFSCache) LookupPackage(pkgName string) (*module.Version, error)
- func (c SimpleFSCache) RegisterPackage(pkg *module.Version) error
- func (c SimpleFSCache) RemovePackage(pkg *module.Version) error
- func (c SimpleFSCache) TestImportPath(importPath string) error
- func (c SimpleFSCache) WritePackageFile(pkg *module.Version, filePath string, f fs.File) error
- type WritableFS
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type MemoryPackageIndex ¶
type MemoryPackageIndex struct {
// contains filtered or unexported fields
}
func NewMemoryPackageIndex ¶
func NewMemoryPackageIndex() *MemoryPackageIndex
func (*MemoryPackageIndex) LookupPackage ¶
func (c *MemoryPackageIndex) LookupPackage(pkgName string) (*module.Version, error)
func (*MemoryPackageIndex) RegisterPackage ¶
func (c *MemoryPackageIndex) RegisterPackage(pkg *module.Version) error
func (*MemoryPackageIndex) RemovePackage ¶
func (c *MemoryPackageIndex) RemovePackage(pkg *module.Version) error
type PMProgressObserver ¶
type PMProgressObserver interface { // DependencyCheckFinish is fired when dependency check finished or stopped due to error. DependencyCheckFinish(err error) // DependencyResolveStart is called at the beginning of dependency resolve process. // // Accepts required packages count. DependencyResolveStart(packagesCount int) // PackageSearchStart is called when package manager starts searching for package. PackageSearchStart(pkgName string) // PackageDownload called during package download progress PackageDownload(pkg *module.Version, progress Progress) // PackageExtract called during package extraction progress PackageExtract(pkg *module.Version, progress Progress) }
PMProgressObserver capture progress events from package manager
type PackageCache ¶
type PackageCache interface { // TestImportPath tests if specified import path is accessible in cache. // // Returns fs.ErrNotExists in case of cache miss. TestImportPath(importPath string) error // LookupPackage checks if package is cached and returns its version. // // Returns fs.ErrNotExists if package is not cached. LookupPackage(pkgName string) (*module.Version, error) // RegisterPackage registers package in index RegisterPackage(pkg *module.Version) error // WritePackageFile writes a single file of package to the storage. WritePackageFile(pkg *module.Version, filePath string, f fs.File) error // RemovePackage removes all cached package files. RemovePackage(pkg *module.Version) error }
type PackageIndex ¶
type PackageIndex interface { // LookupPackage retrieve a package from index. // // Returns fs.ErrNotExists if package not found. LookupPackage(pkgName string) (*module.Version, error) // RegisterPackage adds package to the index. RegisterPackage(pkg *module.Version) error // RemovePackage removes package from index. RemovePackage(pkg *module.Version) error }
type PackageManager ¶
type PackageManager struct {
// contains filtered or unexported fields
}
PackageManager checks and stores program dependencies.
func NewPackageManager ¶
func NewPackageManager(modProxy *goproxy.Client, pkgCache PackageCache) *PackageManager
func (*PackageManager) CheckDependencies ¶
func (mgr *PackageManager) CheckDependencies(ctx context.Context, importPaths []string) (err error)
CheckDependencies checks if import paths are solvable and downloads dependencies if necessary.
func (*PackageManager) SetProgressObserver ¶
func (mgr *PackageManager) SetProgressObserver(pm PMProgressObserver)
SetProgressObserver sets package manager event listener
type SimpleFSCache ¶
type SimpleFSCache struct {
// contains filtered or unexported fields
}
SimpleFSCache is a simple gopath-like package cache.
Doesn't support package versioning.
func NewSimpleFSCache ¶
func NewSimpleFSCache(location string, fs WritableFS, index PackageIndex) *SimpleFSCache
func (SimpleFSCache) LookupPackage ¶
func (c SimpleFSCache) LookupPackage(pkgName string) (*module.Version, error)
func (SimpleFSCache) RegisterPackage ¶
func (c SimpleFSCache) RegisterPackage(pkg *module.Version) error
func (SimpleFSCache) RemovePackage ¶
func (c SimpleFSCache) RemovePackage(pkg *module.Version) error
func (SimpleFSCache) TestImportPath ¶
func (c SimpleFSCache) TestImportPath(importPath string) error
func (SimpleFSCache) WritePackageFile ¶
type WritableFS ¶
type WritableFS interface { // Stat returns file or directory info Stat(name string) (fs.FileInfo, error) // WriteFile creates a new file or replaces file contents. WriteFile(name string, data io.Reader, mode fs.FileMode) error // Mkdir creates a directory named path, along with any necessary // parents, and returns nil, or else returns an error. Mkdir(name string, mode fs.FileMode) error // Remove removes specified item and all children files. Remove(name string) error }
Click to show internal directories.
Click to hide internal directories.