Documentation ¶
Overview ¶
Package goreleases lists all or supported Go toolchain releases, and download/verify/extract them.
A list of releases is retrieved from golang.org/dl/?mode=json, optionally with the include=all parameter. The released files are assumed to contain just a directory named "go" with a release.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Fetch ¶
func Fetch(file File, dst string, permissions *Permissions) error
Fetch downloads, extracts and verifies a Go release represented by file into directory dst. After a successful fetch, dst contains a directory "go" with the specified release. Directory dst must exist. It must not already contain a "go" subdirectory. Only files with filenames ending .tar.gz are supported. So no macOS or Windows. If permissions is not nil, it is applied to extracted files and directories.
Types ¶
type File ¶
type File struct { Filename string `json:"filename"` // .tar.gz for unix-oriended files (source and binary), .pkg for macOS, .zip and .msi for Windows. Os string `json:"os"` Arch string `json:"arch"` Version string `json:"version"` Sha256 string `json:"sha256"` Size int64 `json:"size"` Kind string `json:"kind"` // "source", "archive", "package" }
File is a released file for a released go version.
type Permissions ¶
type Permissions struct { Uid int Gid int Mode os.FileMode // Mode to use for extract files and directories. Files are masked with 0777 or 0666 depending on whether 0100 is set. }
Permissions to set on extract files and directories, overriding permissions in the archive.
type Release ¶
type Release struct { Version string `json:"version"` Stable bool `json:"stable"` Files []File `json:"files"` }
Release is a released Go toolchain version, with files for several Os/Arch combinations.
func ListSupported ¶
ListSupported returns supported Go releases.