utils

package
v1.0.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2020 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TarBinary uint64 = iota + 1
	MsiBinary
	PkgBinary
	ZipBinary
)

Represent the package extension of the compressed go source code that are available at https://golang.org/dl/

Variables

View Source
var (
	// ErrSourceDoesNotExists represents the error when the remote file does not exists
	ErrSourceDoesNotExists = errors.New("remote file does not exists")
)
View Source
var (
	// ErrUnknowPackage error used when package is not Tar,Msi,pkg or zip
	ErrUnknowPackage = errors.New("unknow package")
)

Functions

func DefaultPackageType

func DefaultPackageType() (pts string, pti uint64)

DefaultPackageType return the default package type for every supported system.

func GetCurrentGoVersion

func GetCurrentGoVersion() (string, error)

GetCurrentGoVersion returns the current version of go which is in the global path:

unix -> $PATH windows ->

func GetCurrentGoVersionAll

func GetCurrentGoVersionAll() (string, error)

GetCurrentGoVersionAll returns the full go version

func GetGoVersion

func GetGoVersion(goBinPath string) (string, error)

GetGoVersion returns the current version of go which is in the path passed as parameter.

func GetGoVersionAll

func GetGoVersionAll(goBinPath string) (string, error)

GetGoVersionAll returns the full go version by example: go version go1.14 linux/amd64

func GetPackageFilename

func GetPackageFilename(goversion, os, arch string, pType string) (string, error)

GetPackageFilename return the compressed go source filename with the go version, operating system, architecture and package type.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client represents the client used to download files

func DefaultClient

func DefaultClient(srcFile, dstFile string) *Client

DefaultClient will create the default client to download files, only receive source file and destiny file.

func (*Client) Download

func (d *Client) Download(cb dCallback) error

Download will download files and show progress

type Stats

type Stats struct {
	BytesDownloaded      string
	BytesToDownload      string
	DownloadedPercentage string
}

Stats represents the download stats

Jump to

Keyboard shortcuts

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