pkg

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2022 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultGoenvRootDirectory = "/usr/local/go"
	DefaultGoInstallDirectory = "/usr/local/goenv"

	GoEnvRootDirEnvVar    = "GOENV_ROOT_DIR"
	GoEnvInstallDirEnvVar = "GOENV_INSTALL_DIR"
)

Variables

This section is empty.

Functions

func CheckRW

func CheckRW(config *Config) []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)

func Print added in v0.0.4

func Print(g map[string][]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 Config added in v0.0.4

type Config struct {
	// The file placed at GoenvRootDirectory is a symlink to the GoenvInstallDirectory
	GoenvRootDirectory string

	// Install directory defaults to /usr/local/goenv and can be configured with
	GoenvInstallDirectory string
}

func ReadConfig added in v0.0.4

func ReadConfig() *Config

ReadConfig reads the environment variables for a user and creates a config. If we need any additional config, it'll be parsed in here.

func (*Config) String added in v0.0.4

func (c *Config) String() 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

func GetGoVersions added in v0.1.0

func GetGoVersions(getAllVersions bool) ([]Release, error)

GetGoVersions queries the go.dev/dl for the current releases. The latest patch versions of the latest two minor versions are considered stable. If you want all releases of Go, pass in true.

Jump to

Keyboard shortcuts

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