godelgetter

package
v2.20.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2019 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Download

func Download(pkgSrc PkgSrc, dstFilePath string, w io.Writer) (rErr error)

Download downloads the provided package to the specified path. The parent directory of the path must exist. If the destination file already exists, it is overwritten. The download progress is written to the provided writer.

func DownloadIntoDirectory

func DownloadIntoDirectory(pkgSrc PkgSrc, dstDir string, w io.Writer) (rPkg string, rErr error)

DownloadIntoDirectory downloads the provided package into the specified output directory. The output directory must already exist. The download progress is written to the provided writer. Returns the path to the downloaded file. If the path of pkgSrc and the download destination both refer to the same file (and the file exists), then if a checksum is provided it is verified (otherwise it is a no-op).

Types

type PkgSourceParam

type PkgSourceParam interface {
	// contains filtered or unexported methods
}

func PkgSrcCanonicalSourceParam

func PkgSrcCanonicalSourceParam(canonicalSource string) PkgSourceParam

type PkgSrc

type PkgSrc interface {
	// Returns the name of this package.
	Name() string
	// Returns the path to the source of this package.
	Path() string
	// Returns the canonical source for this package. This is an optional value. If this value is set, it indicates that
	// the value returned by "Path()" is the preferred source for the package, but this value represents the canonical
	// source path of the package.
	CanonicalSource() string
	// Returns the expected SHA-256 checksum for the package. If this function returns an empty string, then a checksum
	// will not be performed.
	Checksum() string
	// Same returns true if the PkgSrc is known to provide the same file as the destination path.
	Same(dstPath string) bool
	// Returns a reader that can be used to read the package and the size of the package. Reader will be open and ready
	// for reads -- the caller is responsible for closing the reader when done.
	Reader() (io.ReadCloser, int64, error)
}

func NewPkgSrc

func NewPkgSrc(srcPath, checksum string, params ...PkgSourceParam) PkgSrc

Jump to

Keyboard shortcuts

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