Documentation ¶
Overview ¶
Package goreleases lists all or supported Go toolchain releases, and download/verify/extract them.
A list of releases is retrieved from go.dev/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 a toolchain represented, downloads and verifies its gpg signature, and extracts it 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 and .zip can be fetched. Tar.gz files are extracted while fetched. Zip files are first read into memory, then extracted.
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. Uid and gid are only set when at least one of them is >= 0. Setting uid/gid will fail on Windows.
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.