Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Download ¶ added in v0.8.0
func Download(destDir string, opts DownloadOptions) error
func DownloadToGopathBin ¶
func DownloadToGopathBin(opts DownloadOptions) error
DownloadToGopathBin takes a Go templated URL and expands template variables - srcTemplate is the URL - version is the version to substitute into the template - ext is the file extension to substitute into the template
Template Variables: - {{.GOOS}} - {{.GOARCH}} - {{.EXT}} - {{.VERSION}}
func RenderTemplate ¶
func RenderTemplate(tmplContents string, opts DownloadOptions) (string, error)
RenderTemplate takes a Go templated string and expands template variables Available Template Variables: - {{.GOOS}} - {{.GOARCH}} - {{.EXT}} - {{.VERSION}}
Types ¶
type DownloadOptions ¶
type DownloadOptions struct {
// UrlTemplate is the Go template for the URL to download. Required.
// Available Template Variables:
// - {{.GOOS}}
// - {{.GOARCH}}
// - {{.EXT}}
// - {{.VERSION}}
UrlTemplate string
// Name of the binary, excluding OS specific file extension. Required.
Name string
// Version to replace {{.VERSION}} in the URL template. Optional depending on whether or not the version is in the UrlTemplate.
Version string
// Ext to replace {{.EXT}} in the URL template. Optional, defaults to xplat.FileExt().
Ext string
// OsReplacement maps from a GOOS to the os keyword used for the download. Optional, defaults to empty.
OsReplacement map[string]string
// ArchReplacement maps from a GOARCH to the arch keyword used for the download. Optional, defaults to empty.
ArchReplacement map[string]string
// Hook to call after downloading the file.
Hook PostDownloadHook
}
DownloadOptions is the configuration settings used to download a file.
type PostDownloadHook ¶
PostDownloadHook is the handler called after downloading a file, which returns the absolute path to the binary.
Click to show internal directories.
Click to hide internal directories.