pacman

package
v1.15.1 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2024 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseFileImports

func ParseFileImports(filename, moduleUrl string, code []byte) ([]string, error)

ParseFileImports returns imported packages from Go source text

Types

type HostFS

type HostFS struct{}

func NewHostFS

func NewHostFS() HostFS

func (HostFS) Mkdir

func (w HostFS) Mkdir(name string, mode fs.FileMode) error

func (HostFS) Remove

func (w HostFS) Remove(name string) error

func (HostFS) Stat

func (w HostFS) Stat(name string) (fs.FileInfo, error)

func (HostFS) WriteFile

func (w HostFS) WriteFile(name string, data io.Reader, mode fs.FileMode) error

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 Progress

type Progress struct {
	Total   int
	Current int
}

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

func (c SimpleFSCache) WritePackageFile(pkg *module.Version, filePath string, f fs.File) error

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
}

Jump to

Keyboard shortcuts

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