cockroach: github.com/cockroachdb/cockroach/pkg/util/binfetcher Index | Files

package binfetcher

import "github.com/cockroachdb/cockroach/pkg/util/binfetcher"

Index

Package Files

binfetcher.go extract.go

func Download Uses

func Download(ctx context.Context, opts Options) (string, error)

Download downloads the binary for the given version, and skips the download if the archive is already present in `destDir`.

`version` can be:

- a release, e.g. v1.0.5 (makes sense only for downloading `cockroach`) - a SHA from the master branch, e.g. bd828feaa309578142fe7ad2d89ee1b70adbd52d - the string "LATEST" for the most recent SHA from the master branch. Note that

caching is disabled in that case.

Returns the path to the (executable) binary.

type Options Uses

type Options struct {
    Binary  string
    Version string

    // These are optional but should usually be set.
    Dir    string // empty for OS temp dir
    GOOS   string // empty for build-time GOOS
    GOARCH string // empty for build-time GOOS

    // These are optional and rarely need to be set.
    Component string  // empty for auto-inferred; this is the "loadgen" in "loadgen/kv"
    Suffix    string  // empty for auto-inferred; either empty, ".zip", or ".tgz"
    URL       url.URL // empty for auto-inferred
}

Options are the options to Download().

Package binfetcher imports 16 packages (graph) and is imported by 2 packages. Updated 2019-08-10. Refresh now. Tools for package owners.