Documentation
¶
Overview ¶
Package pkgdownload provides interfaces and utility functions to download gno packages files.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Download ¶
func Download(pkgPath string, dst string, fetcher PackageFetcher) error
Download downloads the package identified by `pkgPath` in the directory at `dst` using the provided PackageFetcher. The directory at `dst` is created if it does not exists.
Types ¶
type InMemoryFetcher ¶
type InMemoryFetcher struct {
// contains filtered or unexported fields
}
InMemoryFetcher is a PackageFetcher backed by a map of pre-registered MemPackages. Primarily intended for tests where network/filesystem access is undesirable.
InMemoryFetcher is read-only after construction. Register all packages when calling NewInMemoryFetcher; concurrent FetchPackage calls are safe. There is intentionally no public API to mutate the map after creation.
func NewInMemoryFetcher ¶
func NewInMemoryFetcher(pkgs ...*std.MemPackage) *InMemoryFetcher
NewInMemoryFetcher registers the given MemPackages by their Path. If two MemPackages share the same Path, the later one wins.
func (*InMemoryFetcher) FetchPackage ¶
func (f *InMemoryFetcher) FetchPackage(pkgPath string) ([]*std.MemFile, error)
FetchPackage implements PackageFetcher.
type PackageFetcher ¶
func NewNoopFetcher ¶
func NewNoopFetcher() PackageFetcher