Documentation ¶
Index ¶
- Constants
- func CheckRW(config *Config) []string
- func CreateGoVersionList(directories []string) map[string][]string
- func Debug(mesg string)
- func DownloadFile(v *semver.Version) (filepath string, err error)
- func Error(mesg string)
- func ExtractTarGz(tarballPath, destinationPath string) error
- func Info(mesg string)
- func ListAvailableVersions(getAllVersions bool) ([]string, error)
- func Print(g map[string][]string)
- func Success(mesg string)
- func Warn(mesg string)
- type ChecksumSHA256
- type Config
- type File
- type Release
Constants ¶
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 ¶
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
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 DownloadFile ¶
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 ExtractTarGz ¶
ExtractTarGz will do the equivalent of a tar -xzvf -C and untar the tarball to whichever destination path we need to go to.
func ListAvailableVersions ¶ added in v0.1.0
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.
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
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.