Documentation ¶
Index ¶
- func DownloadToFolder(filepath string, resp *http.Response) error
- func GetDownloadURI(downloadURIFmt string, binaryName string) (string, error)
- func GetExecutableName(tool string) string
- func GetLocalFilepath(overrideEnvVarName string, binaryName string) (string, error)
- func GetValidPlatform(currentOS, currentArch string) (string, error)
- type ErrToolNotFound
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DownloadToFolder ¶
DownloadToFolder creates a folder and a file, writes the response body to the file, and makes the file executable by everyone. An error is returned if any of these steps fail.
func GetDownloadURI ¶
GetDownloadURI takes in a download URI format string and a binary name, and returns a download URI string based on the runtime OS and architecture, or an error if the platform is not valid.
func GetExecutableName ¶
GetExecutableName returns the executable name of a given tool based on the operating system. It returns the tool name with a .exe extension if the operating system is Windows, otherwise it returns the tool name as is.
func GetLocalFilepath ¶
GetLocalFilepath checks for an override path in an environment variable, and if it exists, returns it. If not, it returns the path to the binary in the user's home directory. It returns an error if it cannot find the user's home directory or if the filename is invalid.
func GetValidPlatform ¶
GetValidPlatform checks if the given OS and architecture combination is supported and returns the corresponding platform string if it is, or an error if it is not.
Types ¶
type ErrToolNotFound ¶
func (ErrToolNotFound) Error ¶
func (e ErrToolNotFound) Error() string
Error() returns a string containing the error message for the ErrToolNotFound struct.