pkg

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const HttpRequestTimeout = 30

Variables

This section is empty.

Functions

func CheckInstalled added in v0.2.0

func CheckInstalled(goenvInstallDirectory string, version string) error

CheckInstalled simply checks if a directory exists.

func CheckLatestGo added in v0.1.2

func CheckLatestGo() error

CheckLatestGo looks for new stable versions of Go. If new stable versions have been released since the last check, then we'll let the user know. We only print this message once per new set of releases.

func CheckLatestGoenv added in v0.1.2

func CheckLatestGoenv(ctx context.Context, currentVersion *semver.Version) error

CheckLatestGoenv checks the Github releases for a new version of Goenv. If one is found, the one-line install instructions are printed to the console.

func CheckRW

func CheckRW(goenvRootDirectory string, goenvInstallDirectory string) []string

CheckRW checks if the user can install and use Go by making sure they have read and write access to the directories where go will be installed.

func CreateGoVersionList added in v0.0.4

func CreateGoVersionList(directories []string) map[string][]string

CreateGoVersionList will take a list of all the directories in goenv and then parse it into a GoVersionList. We do this so that we can print the installed Go versions nicely for the user.

func Debug

func Debug(mesg string)

func DownloadFile

func DownloadFile(v *semver.Version) (filepath string, err error)

DownloadFile will download a url to a local file. If we have a recorded shasum for the file, we'll check it. We'll return a path to the downloaded file. https://go.dev/dl/go1.18.linux-amd64.tar.gz

func Error added in v0.1.0

func Error(mesg string)

func ExtractTarGz

func ExtractTarGz(tarballPath, destinationPath string) error

ExtractTarGz will do the equivalent of a tar -xzvf -C and untar the tarball to whichever destination path we need to go to.

func Info added in v0.0.4

func Info(mesg string)

func ListAvailableVersions added in v0.1.0

func ListAvailableVersions(getAllVersions bool) ([]string, error)

ListAvailableVersions reads all available versions of Go that can be installed. It queries go.dev for what's available. By default, it'll return only the latest patches of the two most recent minor versions. For example: 1.18: 1.18.7 1.19: 1.19.2

func Print added in v0.0.4

func Print(g map[string][]string, linePrefix string)

Print will nicely display the installed and available versions of Go you can install to the terminal.

func Success

func Success(mesg string)

func Warn added in v0.1.0

func Warn(mesg string)

Types

type ChecksumSHA256 added in v0.1.0

type ChecksumSHA256 string

type File added in v0.1.0

type File struct {
	Filename       string    `json:"filename"`
	OS             string    `json:"os"`
	Arch           string    `json:"arch"`
	Version        string    `json:"version"`
	Checksum       string    `json:"-" datastore:",noindex"` // SHA1; deprecated
	ChecksumSHA256 string    `json:"sha256" datastore:",noindex"`
	Size           int64     `json:"size" datastore:",noindex"`
	Kind           string    `json:"kind"` // "archive", "installer", "source"
	Uploaded       time.Time `json:"-"`
}

This comes from https://github.com/golang/website/blob/master/internal/dl/dl.go

type Release added in v0.1.0

type Release struct {
	Version        string `json:"version"`
	Stable         bool   `json:"stable"`
	Files          []File `json:"files"`
	Visible        bool   `json:"-"` // show files on page load
	SplitPortTable bool   `json:"-"` // whether files should be split by primary/other ports.
}

This comes from https://github.com/golang/website/blob/master/internal/dl/dl.go

Jump to

Keyboard shortcuts

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